[wx-dev] Question regarding how to create an apply buttonusingwxWiggets

Cai, Xin Xin.Cai at viasat.com
Tue Jun 3 19:04:40 PDT 2008


Here is my latest attempt at creating my own button and putting it on
the bottom of the property sheet. First I want to just get the property
sheet to show up so I created a new panel and try to put the
propertysheet in there(can I even do that??) and then add that panel to
my boxsizers and then call showModal to show it. But it didn't work, the
propertysheet didn't show up. Please see code below.

 

// So MY_GUI is now inherited off of wxDialog class and
MyPropertySheetDialog is inherited off of the //wxPropertySheetDialog
class. I am trying to create a propertysheet and then add it to MY_GUI
so //MY_GUI can display it, but it doesn't work.

MY_GUI::MY_GUI( const wxString & title )

: wxDialog(NULL, -1, title, wxDefaultPosition, wxSize(250,230))

{

      wxPanel * panel = new wxPanel(this,-1);

      MyPropertySheetDialog * mySheet = new
MyPropertySheetDialog(panel,"test");

      

      wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);

      

      vbox->Add(panel, 1);

 

      SetSizer(vbox);

 

      ShowModal();

}

 

MyPropertySheetDialog::MyPropertySheetDialog( wxWindow* parent, const
wxString & title )

: wxPropertySheetDialog(parent, -1, title, wxDefaultPosition,
wxSize(250,150))

{

      wxBookCtrlBase* notebook = GetBookCtrl();

 

    wxPanel* generalSettings = CreateGeneralSettingsPage(notebook);

    wxPanel* aestheticSettings = CreateAestheticSettingsPage(notebook);

 

    notebook->AddPage(generalSettings, _("General"));

    notebook->AddPage(aestheticSettings, _("Aesthetics"));

      

      LayoutDialog();

 

} 

Any help would be appreciated.

 

Sincerely

 

Xin Cai

 

________________________________

From: wx-dev-bounces at lists.wxwidgets.org
[mailto:wx-dev-bounces at lists.wxwidgets.org] On Behalf Of Edgar Omar
Sent: Tuesday, June 03, 2008 5:26 PM
To: wx-dev at lists.wxwidgets.org
Subject: Re: [wx-dev] Question regarding how to create an apply
buttonusingwxWiggets

 

I havent used recently the wxPropertySheetDialog, but it actually
extends wxDialog, so I assume you can create your own button and append
it, not sure if you have tried that.

 

it would be something like

wxButton *button1;

button1 = new wxButton(this, ID_WXBUTTON1, wxT("Apply"), wxPoint(0 ,
120), wxDefaultSize, 0, wxDefaultValidator, "name");

just try to place it near the bottom and see if it works, if not I would
have to check some old code to see how I solved some issues.

 

On Tue, Jun 3, 2008 at 7:15 PM, Cai, Xin <Xin.Cai at viasat.com> wrote:

Basically I created my own class derived from wxPropertySheetDialog
class. And right now  here is my constructor for my own class

 

MY_GUI::MY_GUI( const wxString & title )

: wxPropertySheetDialog(NULL, wxID_ANY, title, wxDefaultPosition,
wxSize(250,150))

{

      CreateButtons(wxYES_NO);

      

      

    // Add page

      wxPanel* panel = new wxPanel(GetBookCtrl());

 

    GetBookCtrl()->AddPage(panel, wxT("General"));

      GetBookCtrl()->AddPage(panel, wxT("TEST"));

 

    LayoutDialog();

 

}

 

Inside my OnInit function in main.c I simply create an instance of
MY_GUI class and call the show function. The ultimate goal is to be able
to

display a dialog similar to the "Display properties" dialog in windows.
Thanks

 

Xin Cai 

 

________________________________

From: wx-dev-bounces at lists.wxwidgets.org
[mailto:wx-dev-bounces at lists.wxwidgets.org] On Behalf Of Edgar Omar
Sent: Tuesday, June 03, 2008 5:06 PM
To: wx-dev at lists.wxwidgets.org
Subject: Re: [wx-dev] Question regarding how to create an apply button
usingwxWiggets

 

I need more info than that, like are you in a wxDialog?, if so, you can
add your own buttons like in a normal wxFrame, with wxButton and a
connect event, the trick would be to make them look cool in a wxDialog,
I have some issues trying to fit a wxtextctrl and a label on it

On Tue, Jun 3, 2008 at 7:03 PM, Cai, Xin <Xin.Cai at viasat.com> wrote:

Hi guys

I am trying to create a program that shows a propertysheet and I need to
add an Apply button in addition to OK and cancel, and then I notice that
wxApply is no longer supported. In that case I would like to know how
can I add an apply button manually to my program? Thank you very much

Sincerely
Xin Cai
_______________________________________________
wx-dev mailing list
wx-dev at lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

 


_______________________________________________
wx-dev mailing list
wx-dev at lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-dev/attachments/20080603/c5a53189/attachment-0001.htm


More information about the wx-dev mailing list