Buttons with blue background

Mac OSX specific forum
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Buttons with blue background

Post by Shardik »

I have found out that a lot of native Apple applications (for example
the TextEdit save dialog or the Printer dialog) use buttons with blue
background which even pulsates adjacent to buttons with white
background. PB always displays the buttons with a white background.
Therefore I want to demonstrate how easy it is to display a button
with blue background or with a pulsing blue background:

Code: Select all

ImportC ""
  HiliteControl(ControlRef.L, HiliteState.L)
  SetControlData(Control.L, ControlPartCode.L, TagName.L, BufferSize.L, *Buffer)
EndImport

#kControlButtonPart = 10
#kControlPushButtonDefaultTag = 'dflt'

DrawDefaultRing.B = #True

If OpenWindow(0, 270, 100, 200, 100, "Customized Buttons")
  ButtonGadget(0, 10, 10, 180, 20, "Standard Button")
  ButtonGadget(1, 10, 40, 180, 20, "Pulsing Button")
  ButtonGadget(2, 10, 70, 180, 20, "Highlighted Button")

  SetControlData(GadgetID(1), #kControlButtonPart, #kControlPushButtonDefaultTag, SizeOf(DrawDefaultRing), @DrawDefaultRing)
  HiliteControl(GadgetID(2), #kControlButtonPart)

  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Buttons with blue background

Post by J. Baker »

Nice and simple. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
WilliamL
Addict
Addict
Posts: 1252
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: Buttons with blue background

Post by WilliamL »

Yes, it is great!

If I remember right, the normal Mac usage is that hitting the 'pulsating' button is the same as hitting the 'return' key. It's nice to have that programming ability now (to have it pulse).
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Buttons with blue background

Post by Shardik »

I have just added a new rectangular button with a Metal style appearence:

Code: Select all

ImportC ""
  HiliteControl(ControlRef.L, HiliteState.L)
  SetControlData(ControlRef.L, ControlPartCode.L, TagName.L, BufferSize.L, *Buffer)
  ShowControl(ControlRef.L)
EndImport

#kControlButtonPart = 10
#kControlPushButtonDefaultTag = 'dflt'
#kControlPushButtonIsTexturedTag = 'metl'

DrawDefaultRing.B = #True
IsTextured.B = #True

If OpenWindow(0, 270, 100, 200, 132, "Customized Buttons")
  ButtonGadget(0, 10, 10, 180, 20, "Standard Button")
  ButtonGadget(1, 10, 40, 180, 20, "Pulsing Button")
  ButtonGadget(2, 10, 70, 180, 20, "Highlighted Button")
  ButtonGadget(3, 10, 98, 180, 22, "Metal Button (rectangular)")

  SetControlData(GadgetID(1), #kControlButtonPart, #kControlPushButtonDefaultTag, SizeOf(DrawDefaultRing), @DrawDefaultRing)
  HiliteControl(GadgetID(2), #kControlButtonPart)
  SetControlData(GadgetID(3), #kControlButtonPart, #kControlPushButtonIsTexturedTag, SizeOf(IsTextured), @IsTextured)
  ShowControl(GadgetID(3))

  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Buttons with blue background

Post by J. Baker »

The metal button would be nice for ButtonImageGadget(). ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Post Reply