#Gadgets & Consoles
5 messages in this thread
I am trying to make sense out of the Amiga books on the subject of accessing
gadgets via the console. My problem is this:
I have created a cycle gadget within a window using Gadtools. I have enabled
the window to return gadget up/down messages (using the sequence \X9b7;8{) and
I am getting messages returned ok when clicking on the gadget. What I do NOT
get is the gadget automatically moving to show the the next value.
Do I need to do this automatically or have I failed to set something up.
Any help appreciated.
TIA
Graham
Per the RKMs, you must call GT_SetGadgetAttrs() using the GTCY_Active tag.
Constructing your own Intuimessage and sending it does not in itself emulate a
mouse click on the gadget. After sending the message, respond to it in your
intuition event loop by seeting the active item. You are responsible for
maintaining the list cursor and the list should wrap around.
Bob
Bob
Thanks for the advice. In fact I am clicking on the gadget with the mouse but
looking to detect the action using input from the Console (as described in the
Devices manual).
I suspect the problem is that I expected Intuition to handle the updating of
the gadget image to display the next value. From re-reading the Includes and
AutoDocs info on Gadtools I believe that this action is only carried out for
free as a side effect of GT_GetIMsg (which the Console device doesn't know
about). So either I have to write a complete set of processing routines to
handle all the nasty combination (mouse+lshift, mouse+rshift etc) or I sidestep
the problem and use gadtools completely. I'll have to think about this!
Thanks for your help
G.
GT_GetImsg is pulling messages from the message port. By the time the message
is pulled, I believe Intuition has done all it intends to since all types of
messages could have been put there (mouse moves, etc) befor the app gets around
to pulling the message.
Now it could be that your list of cycle values is not as you intend. You could
establish this with a small test program that opens the window with the gadget
and then sets the active items in a loop (0..n-1). This will detect an invalid
list. Also, is the list in scope where ever it needs to be referenced? You may
need to explicitly allocate memory if the list is created within one function
and used within another – or make it global, pass its address to the function,
etc.
Bob
Thanks for the comment re the scope of lists. I did hit this problem at an
early stage as my system (a Prolog compiler) creates these on the fly rather
than statically.
Regarding the original problem I did eventually type in and compile one of the
RKM examples and used it to experiment with. It appears that it is GT-GetIMsg
that does the update of the gadget for you. I presume that reading a 9B
sequence from the console device doesn't recognise that gadtools are being used
and just exploits the normal intuition GetMsg which doesn't have the beneficial
side effects.