Toggle button

Started by Ivan Iraola, November 13, 2009, 12:56:15 PM

Previous topic - Next topic

Ivan Iraola

On the FF3 designer, there's no option to create a Toggle button (BS_PUSHLIKE) in properties of a BUTTON, I tried using XP Themed button (by Jose Roca) and selected the Toggle State property as TRUE (to act as a toggle) but it didn't work, it doesn't stays "pushed" if you click on it.
Android App Developer
http://www.uncledroid.com

Paul Squires

I didn't think that style applied to regular CommandButtons.

Check out this post as well: http://blogs.msdn.com/oldnewthing/archive/2007/09/21/5021765.aspx

Per the WinAPI Help:

BS_PUSHLIKE
Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn't pushed or checked, and sunken when it is pushed or checked.
Paul Squires
PlanetSquires Software

Ivan Iraola

It would be nice to have that option on the designer, toggle buttons are necessary sometimes.

It seems you need to add %BS_AUTOCHECKBOX, to make it work, I created one manually and it works.


Function FORM1_WM_CREATE ( _
                         hWndForm As Dword, _      ' handle of Form
                         ByVal UserData As Long _  ' optional user defined Long value
                         ) As Long

  Local T&
 
  T& = 0
 
  CreateWindowEx(0, "BUTTON", "Toggle", %BS_PUSHLIKE Or %BS_AUTOCHECKBOX Or %WS_VISIBLE Or %WS_CHILD, 50,50,100,25, HWND_FORM1, %Null, %Null, T&)


End Function
Android App Developer
http://www.uncledroid.com

Paul Squires

?? I don't understand why you created it manually.

CheckBoxes have the BS_PUSHLIKE style from within the PropertyList.

Paul Squires
PlanetSquires Software

Pat Dooley

I'm reminded of the time when I created a SDK function to retrieve the text from listview header. It took an hour or two, since I'm not very good at that sort of thing. Within 5 minutes of getting my function to work, I discovered the same function in FF2 help. I had just overlooked it somehow. Of course I'm better for the experience... maybe.
Pat

Ivan Iraola

Quote from: TechSupport on November 13, 2009, 03:41:13 PM
?? I don't understand why you created it manually.

CheckBoxes have the BS_PUSHLIKE style from within the PropertyList.

DOH!!!

You are right, my mistake, I was looking at the BUTTON control not CHECKBOX.

That happens when you are working and playing a little bit with your new toy  :P
Android App Developer
http://www.uncledroid.com