wxBitmapCheckBox and wxBitmapRadioButton

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
Ugly!
Earned some good credits
Earned some good credits
Posts: 113
Joined: Mon May 09, 2005 5:11 am
Location: Argentina - BS AS

wxBitmapCheckBox and wxBitmapRadioButton

Postby Ugly! » Sun Aug 07, 2005 8:53 am

Hi!!! well, i finish this two classes. I m actually a newbie and these are the fisrt components that i ve ever wrote, so please if you think that something is wrong or there can be improvements (which i m sure there must be) let me know.
I hope this can help somebody, as for the utilty of he clases or as model to create components with custom events (that was the hardest part to get for me).

So thnx to this greate forum, and again, critisize all u think, it would really help me.
Just a newbie - Too many interests, not too many time.

Windows XP SP2
Kubuntu GNU/Linux - Feisty
wxActiveRecordGenerator (aka wxARG) maintainer
Find it at wxCode

Ugly!
Earned some good credits
Earned some good credits
Posts: 113
Joined: Mon May 09, 2005 5:11 am
Location: Argentina - BS AS

Postby Ugly! » Sun Aug 07, 2005 9:07 am

Here are the codes:....

[code]
/////////////////////////////////////////////////////////////////////////////
// Name: BitmapCheckBox.h
// Author: Mat
Last edited by Ugly! on Fri Aug 12, 2005 1:44 pm, edited 1 time in total.
Just a newbie - Too many interests, not too many time.



Windows XP SP2

Kubuntu GNU/Linux - Feisty

wxActiveRecordGenerator (aka wxARG) maintainer

Find it at wxCode

bobmanc
Experienced Solver
Experienced Solver
Posts: 69
Joined: Mon Oct 04, 2004 9:27 pm

Postby bobmanc » Sun Aug 07, 2005 3:49 pm

Graphically it is working great but I can't get the EVT_BMPRADIOBUTTON code to compile. What should that look like? Also is there a way to specify a range like in EVT_MENU_RANGE?

Thanks a lot.

Ugly!
Earned some good credits
Earned some good credits
Posts: 113
Joined: Mon May 09, 2005 5:11 am
Location: Argentina - BS AS

Postby Ugly! » Sun Aug 07, 2005 7:56 pm

bobmanc wrote:Graphically it is working great but I can't get the EVT_BMPRADIOBUTTON code to compile. What should that look like? Also is there a way to specify a range like in EVT_MENU_RANGE?

Thanks a lot.


Please post the compiler errors for the EVT_BMPRADIOBUTTON and what compiler r you using? what version of wxwidgets? platform???
(I had no problem using vc++ 6.0 with wxwidgets 2.6.1 and wx-devcpp 6.7, i have not tried in linux because my linux boxis not working right now)

About EVT_MENU_RANGE i think it could be implemented easely so i ll do it sometime tonight or tomorrow, or you can try to implemented ur self and post the code here.

Regards...
Just a newbie - Too many interests, not too many time.



Windows XP SP2

Kubuntu GNU/Linux - Feisty

wxActiveRecordGenerator (aka wxARG) maintainer

Find it at wxCode

bobmanc
Experienced Solver
Experienced Solver
Posts: 69
Joined: Mon Oct 04, 2004 9:27 pm

Postby bobmanc » Fri Aug 12, 2005 12:26 pm

I got it. I just needed this.

EVT_BMPRADIOBUTTON(IDM_TOOLBAR_TOGGLERADIOBTN1,MyFrame::OnBtn)

void MyFrame::OnBtn(wxBmpRadioButtonEvent& event)
{
//do something here
}

bobmanc
Experienced Solver
Experienced Solver
Posts: 69
Joined: Mon Oct 04, 2004 9:27 pm

Postby bobmanc » Fri Aug 12, 2005 12:29 pm

I ran Boundschecker on it and added this line to stop a memory leak.

wxBitmapRadioGroup::~wxBitmapRadioGroup(){
while(group->GetCount()>0)
group->RemoveAt(0);
delete group; //<===== added this line
}

It also complains about this line. Don't know what to do about that though.

WX_DEFINE_ARRAY(wxBitmapRadioButton *,radioArray);

C:\projects\BitmapRadioButton.h(51) : warning C4284: return type for 'radioArray::reverse_iterator::operator ->' is 'class wxBitmapRadioButton ** ' (ie; not a UDT or referenc
e to a UDT. Will produce errors if applied using infix notation)

Ugly!
Earned some good credits
Earned some good credits
Posts: 113
Joined: Mon May 09, 2005 5:11 am
Location: Argentina - BS AS

Postby Ugly! » Fri Aug 12, 2005 1:17 pm

THNX FOR THE FEEDBACK, i corrected that memory leak.

bobmanc wrote:It also complains about this line. Don't know what to do about that though.
WX_DEFINE_ARRAY(wxBitmapRadioButton *,radioArray);

C:\projects\BitmapRadioButton.h(51) : warning C4284: return type for 'radioArray::reverse_iterator::operator ->' is 'class wxBitmapRadioButton ** ' (ie; not a UDT or referenc
e to a UDT. Will produce errors if applied using infix notation)



I think this is just a warning, nothing big.
Just a newbie - Too many interests, not too many time.



Windows XP SP2

Kubuntu GNU/Linux - Feisty

wxActiveRecordGenerator (aka wxARG) maintainer

Find it at wxCode

Ugly!
Earned some good credits
Earned some good credits
Posts: 113
Joined: Mon May 09, 2005 5:11 am
Location: Argentina - BS AS

Postby Ugly! » Fri Aug 12, 2005 1:46 pm

The code was edited. Fix some bugs. It s posted above.
Regards...
Just a newbie - Too many interests, not too many time.



Windows XP SP2

Kubuntu GNU/Linux - Feisty

wxActiveRecordGenerator (aka wxARG) maintainer

Find it at wxCode

bcteh
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Nov 27, 2006 9:56 am

Postby bcteh » Wed Jun 27, 2007 9:07 am

Hi ,

I try to compile the BitmapCheckBox, but it hit the below error.
Can you help ?

I am using wxWidget 2.8.3 on MS Studio 8 on window XP.

Regards
Teh
1>Compiling...
1>bitmapcheckbox.cpp
1>c:\dev\cafesql\gui\bitmapcheckbox.h(109) : error C2143: syntax error : missing ')' before ','
1>c:\dev\cafesql\gui\bitmapcheckbox.h(109) : error C2373: 'wxEVT_BMPCHECKBOX_CLICKED' : redefinition; different type modifiers
1> c:\dev\cafesql\gui\bitmapcheckbox.h(102) : see declaration of 'wxEVT_BMPCHECKBOX_CLICKED'
1>c:\dev\cafesql\gui\bitmapcheckbox.h(109) : error C2512: 'wxEventTableEntry' : no appropriate default constructor available
1>c:\dev\cafesql\gui\bitmapcheckbox.h(109) : error C2512: 'wxEventTableEntry' : no appropriate default constructor available
1>c:\dev\cafesql\gui\bitmapcheckbox.h(109) : error C2059: syntax error : '-'
1>c:\dev\cafesql\gui\bitmapcheckbox.h(109) : error C2017: illegal escape sequence
1>c:\dev\cafesql\gui\bitmapcheckbox.h(109) : error C2017: illegal escape sequence
1>c:\dev\cafesql\gui\bitmapcheckbox.h(109) : error C2059: syntax error : ')'
1>c:\dev\cafesql\gui\bitmapcheckbox.cpp(17) : error C2143: syntax error : missing ';' before '{'
1>c:\dev\cafesql\gui\bitmapcheckbox.cpp(17) : error C2447: '{' : missing function header (old-style formal list?)

sNapik
In need of some credit
In need of some credit
Posts: 9
Joined: Thu Jul 19, 2007 9:34 pm

Events?

Postby sNapik » Thu Feb 07, 2008 1:27 pm

Hi I tryed this to get working but I got this linker error:
Linking executable: bin\button.exe
obj\buttonMain.o: In function `Z41__static_initialization_and_destruction_0ii':E:/pokus/button/buttonMain.cpp:56: undefined reference to `buttonFrame::OnCheck(wxBmpCheckBoxEvent&)'
collect2: ld returned 1 exit status

Using wxWidgets 2.8 on winXP.

Code: Select all

BEGIN_EVENT_TABLE(buttonFrame, wxFrame)
    EVT_CLOSE(buttonFrame::OnClose)
    EVT_MENU(idMenuQuit, buttonFrame::OnQuit)
    EVT_MENU(idMenuAbout, buttonFrame::OnAbout)

    EVT_BMPCHECKBOX(1010,buttonFrame::OnCheck)
    //EVT_BMPRADIOBUTTON(1011,buttonFrame::radioChanged1)
    //EVT_BMPRADIOBUTTON(1012,buttonFrame::radioChanged2)
END_EVENT_TABLE()



Code: Select all

wxBitmap bsrc1 = wxBitmap(wxT("src1"),wxBITMAP_TYPE_BMP_RESOURCE);
        wxBitmap bsrc2 = wxBitmap(wxT("src2"),wxBITMAP_TYPE_BMP_RESOURCE);
        btn1=new wxBitmapCheckBox(this,1010,&bsrc1,&bsrc2,PUSH_LIKE,wxPoint(170,160));


Code: Select all

void OnCheck(wxBmpCheckBoxEvent& event){

}


Thanks for any tips.. This component looks ideal for my solution and I really want to get it working.

guyothomas
In need of some credit
In need of some credit
Posts: 2
Joined: Wed Mar 05, 2008 3:02 pm

Postby guyothomas » Thu Jul 24, 2008 12:40 pm

Hello all, I got a question not very specific to this topic but that is however in some way related.

I used some instances of wxBitmapCheckBox class in my design and I created them with the wxDefaultPosition parameter.
I add it a bit later in a sizer (in the fane Frame of my app), and then Layout() the sizer.
The result of this is at the launching of the app my bitmap drawn at position (0,0) and staying there untill I click on the checkBox. If I create it with the position (3000,2000), there's still a hole on my window at the CheckBox' position in the sizer.

If someone has an idea or a trick I didn't see to solve this.. I'd be glad!
Thanks,
Tom.

meltahaw
In need of some credit
In need of some credit
Posts: 4
Joined: Sat Aug 14, 2010 11:21 am

Re: wxBitmapCheckBox and wxBitmapRadioButton

Postby meltahaw » Thu Apr 24, 2014 9:20 pm

Hi,
Please I am working with wxGTK3.0.0 and I would like to use wxBitmapCheckBox, can you please send me the code ?

Thanks
Mahmoud


Return to “The Code Dump”

Who is online

Users browsing this forum: No registered users and 1 guest