Page 1 of 1

[Module] Switch Gadget (all OS)

Posted: Sat Dec 14, 2019 1:21 pm
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

Re: [Module] Switch Gadget (all OS)

Posted: Sat Dec 14, 2019 2:59 pm
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.

Re: [Module] Switch Gadget (all OS)

Posted: Sat Dec 14, 2019 4:39 pm
by Thorsten1867
Update: image support

@davido
Bug fixed

Re: [Module] Switch Gadget (all OS)

Posted: Sat Dec 14, 2019 8:00 pm
by davido
@Thorsten1867,

Thank you for the update: Works fine, now. :D

Re: [Module] Switch Gadget (all OS)

Posted: Fri Dec 27, 2019 10:12 am
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