RE: [litwindow-users] Re: wxTextCtrl
Status: Alpha
Brought to you by:
hajokirchhoff
From: yrs90 <yr...@ya...> - 2005-05-01 09:16:53
|
> I will investigate that. Might be a typo or it might be that for > wxTextCtrl SetValue and SetLabel do the same thing. I found the following: http://groups-beta.google.com/group/comp.soft-sys.wxwindows/browse_thread/th read/c3e65abf426862e/06bfe1a5055f37a9 <quote> I believe the correct API calls for working with the contents of a TextCtrl are GetValue and SetValue. The fact that Get/SetLabel works on MSW is probably an artifact of how Windows itself implements the text controls. </quote> > > 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"))) > > I'll investigate. Thanks. I don't have a solution yet. I've tried rules of a few different varieties: RULE("xrcTextCtrl.Value", make_const<accessor>(make_accessor(wxString("test string")))) RULE("xrcTextCtrl.Value", make_accessor(make_expr<wxString>("xrcList.Current.second.Info))) RULE("xrcTextCtrl.Value", make_accessor(make_const<wxString>(wxString("test string")))) wxString test="test string"; BEGIN_RULES() RULE("xrcTargetInfoMain.Value", make_const<accessor>(make_accessor<wxString>(test))) END_RULES() The last case works. The previous tries all fail. The first case compiles but gives me a runtime error. Oddly the crash is in strlen(). It looks like the wxString hasn't been created yet. Below is the simplified-for-readability backtrace. MSVCR80D!strlen+0x30 MSVCP80D!std::basic_string::assign+0x10 MSVCP80D!std::basic_string::basic_string MyApp!litwindow::converter<wxString>::to_string+0x5d [base_objects.cpp @ 36] MyApp!litwindow::converter<wxString>::to_string+0x4d [dataadapterimp.h @ 736] MyApp!litwindow::const_accessor::to_string MyApp!litwindow::wxTextCtrlAdapter::SetValue MyApp!litwindow::converter_with_getset<>::set_value MyApp!litwindow::typed_accessor<>::set MyApp!litwindow::value_assign_expr<>::do_assign MyApp!litwindow::rule_base::execute_immediate MyApp!litwindow::constraint_solver::execute_all_immediate MyApp!litwindow::RapidUI::Start Case 2 and 3, fail during compilation. It complains about 'value_type' not being a member of 'litwindow::accessor'. I am guessing this isn't interesting, but, if it is, I'll send the detailed errors. Case 4 works.... Well that's some progress. However, I still don't see how to dynamically lookup a wxString. make_expr<wxString> returns expr_primary<wxString> so it isn't suitable for changing into an accessor<wxString>. > > - - - > > > > On a different tact, I was puzzled by the following code snippet. > Actually the code does invalidate multiple values here. It is a bit > difficult to see, because the 'Value' is an accessor itself. > ... > RapidUI rules dependency has two flavors. Static dependency means that a > rule depends on an accessor and that never changes its location and type > in memory during the lifetime of the rule. The object pointed to by this > accessor may change, but not the accessor itself. > > Dynamic dependency otoh allows that the accessor itself changes. This explanation is quite interesting. So it follows that rules which pass an accessor are always dynamic because it assigns a replacement accessor each time the rule is updated? What do static dependency rules look like? (For a moment I thought make_expr<const_accessor> but that would just keep the object pointed at from being changed, right?) For the list assignment, the library takes care of invalidating the old accessor so the user need not be concerned. Are there times when the user is required to call NotifyChanged on a value before updating? Joel --- [This E-mail scanned for viruses by Declude Virus] |