[Module] Switch Gadget (all OS)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Thorsten1867
Addict
Addict
Posts: 1265
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

[Module] Switch Gadget (all OS)

Post by Thorsten1867 »

SwitchGadget - Module (all OS / DPI / 64Bit)

Image

Code: Select all

;{ _____ Switch - Commands _____
; Switch::Gadget()             - similar to 'ButtonGadget()'
; Switch::GetData()            - similar to 'GetGadgetData()'
; Switch::GetID()              - similar to 'GetGadgetData()', but it uses a string
; Switch::GetState()           - similar to 'GetGadgetState()'
; Switch::Hide()               - similar to 'HideGadget()'
; Switch::SetAutoResizeFlags() - [#MoveX|#MoveY|#Width|#Height]
; Switch::SetAttribute()       - similar to 'SetGadgetAttribute()'
; Switch::SetColor()           - similar to 'SetGadgetColor()'
; Switch::SetData()            - similar to 'SetGadgetData()'
; Switch::SetFont()            - similar to 'SetGadgetFont()'
; Switch::SetID()              - similar to 'SetGadgetData()', but it uses a string
; Switch::SetState()           - similar to 'SetGadgetState()'
;}
Download: SwitchModule.pbi
Last edited by Thorsten1867 on Fri Dec 20, 2019 3:03 pm, edited 4 times in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]
davido
Addict
Addict
Posts: 1829
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: [Module] Switch Gadget (all OS)

Post by davido »

@Thorsten1867,


There appears to be some missing code on line 616:

Code: Select all

						Switch()\Color\Border = OSX_NSColorToRGB(CocoaMessage(0, 0, "NSColor grayColor"))
						Switch()\Color\Button = 
						Switch()\Color\Gadget = OSX_NSColorToRGB(CocoaMessage(0, 0, "NSColor windowBackgroundColor"))
As a consequence it won't run on OSX.
DE AA EB
User avatar
Thorsten1867
Addict
Addict
Posts: 1265
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Switch Gadget (all OS)

Post by Thorsten1867 »

Update: image support

@davido
Bug fixed
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]
davido
Addict
Addict
Posts: 1829
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: [Module] Switch Gadget (all OS)

Post by davido »

@Thorsten1867,

Thank you for the update: Works fine, now. :D
DE AA EB
User avatar
Thorsten1867
Addict
Addict
Posts: 1265
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Switch Gadget (all OS)

Post by Thorsten1867 »

Update: Event #PB_EventType_Change

Code: Select all

Repeat
  Event = WaitWindowEvent()
  Select Event
    Case Switch::#Event_Gadget ;{ Module Events
      Select EventGadget()  
        Case #Switch1
          If EventType() = #PB_EventType_Change
            Debug "Switch 1: " + Str(EventData())
          EndIf  
        Case #Switch2
          Select EventData()
            Case 1  
              Debug "Switch 2: on"
            Case 0
              Debug "Switch 2: off"
          EndSelect    
        Case #Switch3
          Debug "Switch 2: " + Str(EventData())
      EndSelect ;}
  EndSelect        
Until Event = #PB_Event_CloseWindow
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]
Post Reply