Beispiel #1
0
 wxGridSizer* sizer = new wxGridSizer(3);
 panel->SetSizer(sizer);
 
 wxExItem::UseConfig(false);
 
 wxExItem item("item", "hello string", 1, ITEM_TEXTCTRL, true);
 
 REQUIRE( item.GetColumns() == 1);
 REQUIRE( item.GetInitial().As<wxString>() == "hello string");
 REQUIRE( item.GetIsRequired());
 REQUIRE( item.GetLabel() == "item");
 REQUIRE( item.GetPage().empty());
 REQUIRE( item.GetType() == ITEM_TEXTCTRL);
 REQUIRE( item.GetWindow() == nullptr);
 REQUIRE( item.GetValue().IsNull());
 REQUIRE(!item.IsRowGrowable());
 REQUIRE(!item.Apply());
 
 REQUIRE(!item.ToConfig(false));
 wxExItem::UseConfig(true);
 REQUIRE( item.ToConfig(false));
 wxExItem::UseConfig(false);
 
 item.SetDialog(nullptr);
 item.SetImageList(nullptr);
 item.SetValidator(nullptr);
 
 // setting value if window is nullptr should have no effect.
 REQUIRE(!item.SetValue(wxString("test")));
 REQUIRE( item.GetValue().IsNull());
 
Beispiel #2
0
   false);
 const wxExItem ci_cl_n({"This","Or","Other"});
 const wxExItem ci_user("ci-usr", 
   new wxTextCtrl(), 
   [=](wxWindow* user, wxWindow* parent, bool readonly) {
    ((wxTextCtrl*)user)->Create(parent, 100);}, 
   [=](wxWindow* user, bool save) {
     if (save) wxConfigBase::Get()->Write("mytext", ((wxTextCtrl *)user)->GetValue());
     return true;},
   false,
   LABEL_LEFT,
   [=](wxWindow* user, const wxAny& value, bool save) {
     wxLogStatus(((wxTextCtrl *)user)->GetValue());});
 
 REQUIRE(ci_empty.GetType() == ITEM_EMPTY);
 REQUIRE(!ci_empty.IsRowGrowable());
 REQUIRE(ci_cb.GetType() == ITEM_COMBOBOX);
 REQUIRE(ci_cb_dir.GetType() == ITEM_COMBOBOX_DIR);
 REQUIRE(ci_spacer.GetType() == ITEM_SPACER);
 REQUIRE(ci_sl.GetLabel() == "ci-sl");
 REQUIRE(ci_sl.GetType() == ITEM_SLIDER);
 REQUIRE(ci_vl.GetType() == ITEM_STATICLINE);
 REQUIRE(ci_sp.GetLabel() == "ci-sp");
 REQUIRE(ci_sp.GetType() == ITEM_SPINCTRL);
 REQUIRE(ci_sp_d.GetType() == ITEM_SPINCTRLDOUBLE);
 REQUIRE(ci_str.GetType() == ITEM_TEXTCTRL);
 REQUIRE(ci_hl.GetType() == ITEM_HYPERLINKCTRL);
 REQUIRE(ci_st.GetType() == ITEM_STATICTEXT);
 REQUIRE(ci_int.GetType() == ITEM_TEXTCTRL_INT);
 REQUIRE(ci_rb.GetType() == ITEM_RADIOBOX);
 REQUIRE(ci_bc.GetType() == ITEM_CHECKLISTBOX_BIT);