[litwindow-users] wxTextCtrl
Status: Alpha
Brought to you by:
hajokirchhoff
From: yrs90 <yr...@ya...> - 2005-04-29 04:21:26
|
I get the impression that wxTextCtrl support is currently limited to use with a double value. Why does wxTextCtrlBase::SetValue call wxTextCtrl::SetLabel (rather than wxTextCtrl::SetValue) if the value isn't a double? I found that not passing an accessor in a rule to a property when one was expected causes a crash in rule_base::execute_immediate(). Someday it would be good to generate a warning instead. This is probably a common error. The perpetrator follows. // note defined as PROP_GetSet(accessor, Value). RULE("xrcTextCtrl.Value", make_const<string>(string("test"))) // fails I'd like to assign a wxString to Value, but I'm having trouble figuring out how to convert a wxString to an accessor in a wxTextCtrl rule. I thought wrongly that perhaps the following rule would work. PROP_GetSet(wxString, Info) RULE("xrcTextCtrl.Value", make_accessor(make_expr<wxString>("xrcList.Current.Info"))) Since the only thing I know is an accessor is something declared as a container, I tried using a container. The error makes sense, but doesn't help me understand how to make an accessor. test.push_back(wxString("test1")); test.push_back(wxString("test2")); IMPLEMENT_ADAPTER_CONTAINER(vector<wxString>) RULE("xrcTextCtrl.Value", make_expr<accessor>("test")) This complains that error converter<vector<wxString>>::to_string method wasn't implemented. This makes some sense, because the SetValue code isn't looking for a container. I suppose I could make GetInfo() return an accessor (by calling make_accessor before returning), but then it's not so useful internally. - - - On a different tact, I was puzzled by the following code snippet. // mark current m_value as invalid g_rapidUI->ValueChanged(GetWndAggregate()["Value"], false, false); // assign new accessor m_value=newValue; // and send change notification for new accessor g_rapidUI->ValueChanged(GetWndAggregate()["Value"], false); How/why does the first call to ValueChanged mark m_value as invalid? I had thought the notification was only required after updating. I notice that it won't be solved until the second call, but I thought deferred resolution was just for use when invalidating multiple values. Regards, Joel --- [This E-mail scanned for viruses by Declude Virus] |