ListBox: ActiveGadget()=NULL
Archives Forums/MaxGUI Bug Reports/ListBox: ActiveGadget()=NULL
| ||
This report points to a difference between MaxGui for Windows and MaxGui for OsX. On OsX it causes a crash: The function ActiveGadget() should retun the active Gadget. When I click on an item in a listbox, tihs function return the listbox itself. On OsX the function return NULL. To simulate the bug use the original manual example for CreateListBox() and add this lines: ..... While WaitEvent() Print CurrentEvent.ToString() Select EventID() ..... End Select ;add this:------------------------------------------------------------ Print "step 1" Print "WINDOW GADGET=" + GadgetText(Window) If ActiveGadget()<>Null Print "Gadget is aktiv" Else Print "Gadget is NULL" EndIf Print "step 2" Print "Name of Gadget=" + GadgetText(ActiveGadget()) ;-------------------------------------------- Wend I know it is not good to call GadgetText() of a NULL object, but remember on Windows the ActiveGadget() returns a value!!! This bug is fatal if you want to know, in which window an event occured. Normaly you can search for the mother of a gadget upto you reach a "WINDOW"-Gadget: Function SearchActiveWindow:TGadget() Local tmpGadget:TGadget = ActiveGadget() While (tmpGadget<> Null) And (GadgetClass(tmpGadget) <> GADGET_WINDOW) tmpGadget = GadgetGroup(tmpGadget) Wend Return tmpGadget End Function this is where I dedected the bug. I found the bug on OsX 10.6 with BlitzMax 1.48 (with official MaxGui) |
| ||
Here is modified CreateListBox example. On OSX I am getting ActiveGadget and EventGadget non NULL for ListBox events, but NULL for window events like dragging the window (seems wrong) so am a bit confused. |
| ||
Hello skidracer, this sounds strange: The problem for me is the EVENT_GADGETSELECT event. After this event the ActiveGadget() returns NULL instead of the "Listbox" on OsX 10.6 What will you tell me with your sample code? What shall I test? |