[litwindow-users] Re: wxTextCtrl
Status: Alpha
Brought to you by:
hajokirchhoff
|
From: Hajo K. <mai...@ha...> - 2005-05-01 06:56:37
|
Hi,
> 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")))
of course, now I remember :)
Use xrcTextCtrl.Label instead of .Value.
The Value property is indeed an accessor. I don't know if it is possible
to pass an accessor using explicit rules. If it is, it should be
make_expr<accessor>("xrcList.Current.Info")
and make_expr should 'cast' the string to an accessor implicitly. Or
something like this. Your expression above tried to make an accessor for
the expression, which will not work.
wxTextCtrl has three properties that can be used for the actual text:
Value is of type accessor and automatically detects the correct type.
Double is of type double.
Label is of type string.
So for double variables you'd use
xrcTextCtrl.Double = m_myDouble
for string you'd use
xrcTextCtrl.Label = m_myString
I choose label because it is inherited by all controls.
The Value property comes in handy when you are using implicit rules
where your data variable and text ctrl name are the same. RapidUI will
create the rule automatically.
Regards
Hajo
|