It is currently Fri Aug 14, 2020 1:02 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: [Module] Switch Gadget (all OS)
PostPosted: Sat Dec 14, 2019 1:21 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
SwitchGadget - Module (all OS / DPI / 64Bit)

Image

Code:
;{ _____ 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

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

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


Last edited by Thorsten1867 on Fri Dec 20, 2019 3:03 pm, edited 4 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Switch Gadget (all OS)
PostPosted: Sat Dec 14, 2019 2:59 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1774
Location: Uttoxeter, UK
@Thorsten1867,


There appears to be some missing code on line 616:
Code:
                  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


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Switch Gadget (all OS)
PostPosted: Sat Dec 14, 2019 4:39 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
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]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Switch Gadget (all OS)
PostPosted: Sat Dec 14, 2019 8:00 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1774
Location: Uttoxeter, UK
@Thorsten1867,

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

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Switch Gadget (all OS)
PostPosted: Fri Dec 27, 2019 10:12 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
Update: Event #PB_EventType_Change

Code:
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]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye