Page 1 of 1

Flat Buttons In PB

Posted: Thu Jun 12, 2003 9:14 pm
by Num3
Courtesy of Windows API

Code: Select all

Declare Open_Window_0()

;- Window Constants
;
#Window_0  = 0
#BS_FLAT  = $8000
#GWL_STYLE  =  - 16
#WS_CHILD  = $40000000
;- Gadget Constants
;
#Gadget_0  = 0


Procedure Open_Window_0()
  If OpenWindow(#Window_0, 251, 249, 191, 300, #PB_Window_SystemMenu  | #PB_Window_SizeGadget  | #PB_Window_TitleBar , "Flat Button")
    If CreateGadgetList(WindowID())
      ButtonGadget(#Gadget_0,  25, 100, 140, 40, "Flat Button")
      setwindowlong_(GadgetID(#gadget_0), #GWL_STYLE,  #BS_FLAT)
      HideGadget(#Gadget_0,  0) ; Need to redraw the gadget after changing it's style :(
    EndIf
  EndIf
EndProcedure


open_window_0()
Repeat
  Event  = WaitWindowEvent()
  
  
Until Event  = #PB_EventCloseWindow
CODE EDITED (THANKS GPI!!!)

Code: Select all

Declare Open_Window_0()

;- Window Constants
;
#Window_0  = 0
#BS_FLAT  = $8000
;- Gadget Constants
;
#Gadget_0  = 0


Procedure Open_Window_0()
  If OpenWindow(#Window_0, 251, 249, 191, 300, #PB_Window_SystemMenu  | #PB_Window_SizeGadget  | #PB_Window_TitleBar , "Flat Button")
    If CreateGadgetList(WindowID())
      ButtonGadget(#Gadget_0,  25, 100, 140, 40, "Flat Button",#BS_FLAT)

    EndIf
  EndIf
EndProcedure


open_window_0()
Repeat
  Event  = WaitWindowEvent()
  
  
Until Event  = #PB_EventCloseWindow

Re: Flat Buttons In PB

Posted: Fri Jun 13, 2003 7:33 am
by GPI
this is shorter

Code: Select all

      ButtonGadget(#Gadget_0,  25, 100, 140, 40, "Flat Button",#bs_flat)

Posted: Fri Jun 13, 2003 11:17 am
by eddy
I search the same tip but for ButtonImage ...
To do a toolbar button