Button with BUTTON_PushButton -> what is the prop to know the state ? -> It's GA_Selected .
Post date
Sat, 11/01/2025 - 19:48
Button with BUTTON_PushButton -> what is the prop to know the state ?
button.h says:
#define BUTTON_PushButton (BUTTON_Dummy+1)
/* (BOOL) Indicate whether button stays depressed when clicked */
... works nice, I can toggle the pushed state.
but then later in the code, I need to know If it's actually pressed or not. and I can find an attrib for that nowhere.
Online Status
... so buttons with BUTTON_PushButton,TRUE can be "toggled" , but then if I get a click event with WMHI_GADGETUP,
nothing tells if the button is now in pushed state or not. There is a GA_ToggleSelect at gadget level, but it return always 0.
Object* mybutton = NewObject( BUTTON_GetClass(),NULL,
GA_Text,(ULONG)pdisplayname,
GA_RelVerify, TRUE,
BUTTON_Justification, BCJ_LEFT,
BUTTON_PushButton, TRUE,
GA_ID,(GAD_START_SELECT_TEMPLATE),
TAG_END);
I try to get state with:
ULONG selected;
GetAttr(GA_ToggleSelect, mybutton, &selected);