Toggle Button

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
SteveP
Knows some wx things
Knows some wx things
Posts: 27
Joined: Tue Feb 08, 2005 10:40 pm
Contact:

Toggle Button

Post by SteveP »

Maybe I'm just not looking in the right places, but I don't see a toggle button option on the frame editor, and I don't see anything about wxDevCPP not implementing that.

Is the Toggle Button not implemented in wxDevCPP? If not, I'm sure it can be created in the traditional manner, correct? Will there be one implemented in a future version?

If I missed a post or a mention in the tutorial about this, I'd be glad to know.
Dev-C++ 4.9.9.2-wx-beta-6.7
Windows 2000
tbreina
Moderator
Moderator
Posts: 1289
Joined: Thu Nov 25, 2004 7:38 pm
Location: Coronado, CA

Post by tbreina »

No. No toggle button, but you can implement it in the standard way. Just make sure you add it outside of any comment blocks that say ////GUI Items Creation Start and ////GUI Items Creation End. Otherwise, your code will get overwritten when you update the form designer.

Eventually a ToggleButton will be added. Probably something like #33 of a list of 3300 :wink:

-Tony
Everybody's got something to hide except for me and my monkey.
SteveP
Knows some wx things
Knows some wx things
Posts: 27
Joined: Tue Feb 08, 2005 10:40 pm
Contact:

Post by SteveP »

Very good, that will work fine. Thank you very much!
Dev-C++ 4.9.9.2-wx-beta-6.7
Windows 2000
NinjaNL
Moderator
Moderator
Posts: 899
Joined: Sun Oct 03, 2004 10:33 am
Location: Oosterwolde, Netherlands

Re: Toggle Button

Post by NinjaNL »

SteveP wrote:Is the Toggle Button not implemented in wxDevCPP? If not, I'm sure it can be created in the traditional manner, correct?
You can also add a wxButton to your form, add an OnClick event so you have a function prototype to play with, then change the BaseClass to wxToggleButton, and then add your own event for the button (between the

Code: Select all

BEGIN_EVENT_TABLE(Untitled1Dlg,wxDialog)
	////Manual Code Start
	////Manual Code End
tags so it looks something like

Code: Select all

BEGIN_EVENT_TABLE(Untitled1Dlg,wxDialog)
	////Manual Code Start
EVT_TOGGLEBUTTON(ID_WXBUTTON2,Untitled1Dlg::WxButton2Click)
	////Manual Code End
Then in the provided function protoptype, add your code.
Follow the development of my screenplay authoring program at http://wxscreenplaywriter.blogspot.com/
SteveP
Knows some wx things
Knows some wx things
Posts: 27
Joined: Tue Feb 08, 2005 10:40 pm
Contact:

Post by SteveP »

NinjaNL,

Thank you very much for the demonstration on how to change a regular button to a toggle button.

It tells me that wxToggleButton is undeclared. Do I need to update any of the header files or anything like this?

Steve
Dev-C++ 4.9.9.2-wx-beta-6.7
Windows 2000
NinjaNL
Moderator
Moderator
Posts: 899
Joined: Sun Oct 03, 2004 10:33 am
Location: Oosterwolde, Netherlands

Post by NinjaNL »

SteveP wrote:It tells me that wxToggleButton is undeclared. Do I need to update any of the header files or anything like this?
No, just add the header wx/tglbtn.h to your form.h file

Code: Select all

#include <wx/tglbtn.h>
Then it should compile fine.
Follow the development of my screenplay authoring program at http://wxscreenplaywriter.blogspot.com/
SteveP
Knows some wx things
Knows some wx things
Posts: 27
Joined: Tue Feb 08, 2005 10:40 pm
Contact:

Post by SteveP »

Thank you very much! How silly of me to forget that! :oops:
Dev-C++ 4.9.9.2-wx-beta-6.7
Windows 2000
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton »

NinjaNL wrote:
#include <wx/tglbtn.h>
Remember to use the code tag :) - putting less than and greater than signs messes up the current line :).
[Mostly retired moderator, still check in to clean up some stuff]
NinjaNL
Moderator
Moderator
Posts: 899
Joined: Sun Oct 03, 2004 10:33 am
Location: Oosterwolde, Netherlands

Post by NinjaNL »

Ryan Norton wrote:
NinjaNL wrote:
#include <wx/tglbtn.h>
Remember to use the code tag :) - putting less than and greater than signs messes up the current line :).
My turn :oops: :oops: :oops: :oops:
Follow the development of my screenplay authoring program at http://wxscreenplaywriter.blogspot.com/
SteveP
Knows some wx things
Knows some wx things
Posts: 27
Joined: Tue Feb 08, 2005 10:40 pm
Contact:

Post by SteveP »

NinjaNL,

No reason to be embarassed, it worked fine & I knew what you meant. Either way, you're still an expert :D . Heck, that tutorial alone is an awesome accomplishment.

Steve
Dev-C++ 4.9.9.2-wx-beta-6.7
Windows 2000
Post Reply