English Amiga Board

Go Back   English Amiga Board > Coders > Coders. System

Thread Tools
Old 22 August 2017, 01:42   #1
Registered User

matburton's Avatar
Join Date: Apr 2017
Location: Guernsey
Posts: 68
Unhappy Is there workaround for missing IDCMP_GADGETUP messages?

Hey all,

For fun I've been writing a workbench app for my yellowing Amiga 500.

I have some string gadgets, and receive IDCMP_GADGETUP messages when the user has changed the contents of any of them. That works perfectly as long as the user pressed enter to complete the value change.

It seems that if the user instead just clicks away from the string gadget the value is changed but I don't get a GADGETUP message: http://amigadev.elowar.com/read/ADCD.../node0166.html
The gadget may become inactive without the application receiving an IDCMP_GADGETUP message. This will happen if the user performs some other operation with the mouse or if another window is activated. The gadget may still contain updated, valid information even though the IDCMP_GADGETUP message was not received.
I'm using kickstart 1.3 and workbench 1.3.2 (but this also seems to apply to later kickstart and workbench versions)

Is there any kind of workaround (on kickstart 1.3) so that I can know always know when the value of a string gadget has been changed?
matburton is offline  
Old 22 August 2017, 02:27   #2
Registered User
r.cade's Avatar
Join Date: Aug 2006
Location: Augusta, Georgia, USA
Posts: 327
Send a message via AIM to r.cade Send a message via MSN to r.cade Send a message via Yahoo to r.cade
I would guess you need to store what is entered in the boxes and periodically see if they have changed.
r.cade is offline  
Old 22 August 2017, 11:20   #3
Registered User

Daedalus's Avatar
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 3,558
Yep, that's a particular characteristic of the OS-included gadgets unfortunately - famously responsible for much stress during hard drive installation, where HDToolbox won't remember your settings unless you press enter after entering a value manually.

One workaround, and the method I use, is to not bother with the gadget up message at all unless you explicitly want the program to carry out an action when enter is pressed. I simply use a routine to read all the gadget values in one go, and call that whenever the values are actually needed, e.g. when closing the window, clicking Save or Use etc. If you want an action to happen automatically when pressing Enter, you can call it then too, or when a gadget is activated that relies on the content of the other gadgets. No need to do it periodically (also, doing so means setting up timers and counters instead of just waiting for the next gadget event).
Daedalus is offline  
Old 23 August 2017, 00:58   #4
Registered User

matburton's Avatar
Join Date: Apr 2017
Location: Guernsey
Posts: 68
Thanks Daedalus and r.cade

I was hoping there might be some sneaky way I'd overlooked I'll swap to what Daedalus suggested and rather than performing any logic up-front I'll swap to checking later and displaying a requester perhaps to explain what's wrong if there's anything that doesn't validate.

For context (and perhaps a laugh) here's what I've made so far, it's just a sudoku solver. If you sneak in high or negative values by clicking away you end-up trample surrounding memory with various not-so-great results.

Attached Thumbnails
Click image for larger version

Name:	workbench-1.3-crash.gif
Views:	139
Size:	86.9 KB
ID:	54285  
matburton is offline  

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any way to workaround WHDRun problem? jimmy2x2x support.Other 2 28 October 2014 17:34
Gnome Ranger & Lancelot gfx glitches workaround NewDeli project.WHDLoad 24 29 September 2009 17:27
Workaround found for running WinUAE under Wine/Linux mark_k support.WinUAE 14 24 November 2008 04:56
Possible slowdown workaround Toni Wilen support.WinUAE 3 03 September 2005 01:21

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 17:19.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.06213 seconds with 13 queries