Page 1 of 1

Hilight button in CoCo

Posted: Tue Jan 22, 2013 6:57 am
by spacebuddy
is there any way to highlight a button compiling to coco using x86.?

Thanks

Re: Hilight button in CoCo

Posted: Tue Jan 22, 2013 9:35 am
by wilbert
In 5.1 you can use the CocoaMessage command to do something like that.
If you want to toggle a button, you can use SetGadgetState().

Re: Hilight button in CoCo

Posted: Wed Jan 23, 2013 7:51 pm
by Shardik
spacebuddy wrote:is there any way to highlight a button compiling to coco using x86.?
For PB 5.10 (x86 or x64):

Code: Select all

Procedure HighlightButton(WindowID, GadgetID)
  CocoaMessage(0, WindowID(WindowID), "setDefaultButtonCell:", CocoaMessage(0, GadgetID(GadgetID), "cell"))
EndProcedure

OpenWindow(0, 270, 100, 200, 95, "ButtonGadgets")
ButtonGadget(0, 20, 20, 160, 25, "Standard Button")
ButtonGadget(1, 20, 55, 160, 25, "Highlighted Button")
HighlightButton(0, 1)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: Hilight button in CoCo

Posted: Wed Jan 23, 2013 7:59 pm
by Fred
I think than #PB_Button_Default flag should work as well.

Re: Hilight button in CoCo

Posted: Wed Jan 23, 2013 8:29 pm
by Shardik
Fred wrote:I think than #PB_Button_Default flag should work as well.
That's right and it doesn't require API at all. Sorry that I overlooked this... :oops:

Code: Select all

OpenWindow(0, 270, 100, 200, 95, "ButtonGadgets")
ButtonGadget(0, 20, 20, 160, 25, "Standard Button")
ButtonGadget(1, 20, 55, 160, 25, "Highlighted Button", #PB_Button_Default)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow