Page 1 of 1

ButtonGadget with Icons

Posted: Tue Apr 07, 2009 7:57 pm
by va!n
As far as i know their is no PB command to add an Icon to an ButtonGadget!
It would be really great, if this (nice looking) feature would be added to add #LEFT from the text an icon !

If its still implented, please let me know how to do it with PB, thx

Posted: Tue Apr 07, 2009 9:05 pm
by Hroudtwolf
Hi,

Try this....

Code: Select all

Define.i idWindow = OpenWindow ( #PB_Any , #PB_Ignore , #PB_Ignore , 300 , 50 , "Button" , #PB_Window_ScreenCentered | #PB_Window_SystemMenu )
Define.i idButton1 = ButtonImageGadget ( #PB_Any , 0 , 0 , 150 , 50 , LoadIcon_( #Null , #IDI_HAND ) , #BS_TEXT | #BS_LEFT )
Define.i idButton2 = ButtonImageGadget ( #PB_Any , 150 , 0 , 150 , 50 , LoadIcon_( #Null , #IDI_WARNING ) , #BS_TEXT | #BS_LEFT )

SetGadgetText ( idButton1 , "Hello" )
SetGadgetText ( idButton2 , "World" )
 

Repeat
   Select WaitWindowEvent ()
      Case #PB_Event_CloseWindow
      End
      
   EndSelect
ForEver
Regards
Wolf

Posted: Tue Apr 07, 2009 9:28 pm
by Tranquil
SetGadgetText is not supported on ButtonImageGadget according to the manual. Wonder if that work.

Posted: Tue Apr 07, 2009 9:51 pm
by ts-soft
Tranquil wrote:SetGadgetText is not supported on ButtonImageGadget according to the manual. Wonder if that work.
SetGadgetText works on all Gadgets, but the text is not always visible :wink:

Posted: Fri Apr 10, 2009 11:08 am
by va!n
thx for the help... however it would be nice to have a native PB command to add icons (left, center, right) to a ButtonGadget for all OS instead using API!