PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Ivan Iraola on November 13, 2009, 12:56:15 PM

Title: Toggle button
Post by: Ivan Iraola on November 13, 2009, 12:56:15 PM
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.
Title: Re: Toggle button
Post by: Paul Squires on November 13, 2009, 02:37:29 PM
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.
Title: Re: Toggle button
Post by: Ivan Iraola on November 13, 2009, 03:09:51 PM
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
Title: Re: Toggle button
Post by: Paul Squires 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.

Title: Re: Toggle button
Post by: Pat Dooley on November 13, 2009, 04:20:24 PM
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
Title: Re: Toggle button
Post by: Ivan Iraola on November 13, 2009, 04:36:29 PM
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