From: Mattia B. <mb...@ds...> - 2002-09-07 20:18:48
|
> -----Original Message----- > From: Mattia Barbon [mailto:mb...@ds...] > Sent: Friday, September 06, 2002 8:38 AM > To: Everett, Toby > Cc: wxp...@li... > Subject: Re: [wxperl-users] Wx::ComboBox::SetValue ineffective when > wxCB_READONLY is set > > > If this is under wxMSW, it is a known bug; I can reproduce it > > with CVS wxWindows 2.3.3 under Windows; wxGTK (and I assume wxMOTIF), > > seem to work fine. I am going to commit a fix for this in wxWindows; > > this should be in 2.3.3 release. > MSW = Microsoft Windows, right? BTW, where is the best place to search for Yes > known bugs? wxPerl bug tracker, wxWindows bug tracker; in this case this one was not in the tracker (was discussed < 2 weeks ago on wx-...@li...) > > > way through the darkness, but I'm making reasonably good progress in > doing > > > my first test port of a Tk app. There are definitely some Tk things I > miss > > > (-textvariable, for one:), but I will say the native look and feel is > > ^^^^^^^^^^^^^ > > Curious: what does it do? > It hooks a variable to the value of a widget. You pass it a reference to a > scalar, like so: > <create_new_widget> . . . -textvariable => \$myvar . . . > Then, whenever you update $myvar, the value in the equivalent of a TextCtrl > or whatever changes. Similarly, when you change the value in the widget OK, it is what I thought it was. > interactively, the value in $myvar changes. I'm not quite sure how it's > done internally. A widget->variable equivalent can be done like so: It uses magic (really! magic is used internally by perl to implement, among other things, tied variables, %ENV, lvalue subroutines, like pos() and substr(), ...). <snip> > Note that the calling syntax is Wx::TiedVariable::Set($widget, $$ref). This > is intentional, because it would allow Set to be hooked into the Wx:: > hierarchy at the right point using something akin to > *Wx::RightHierarchyPoint::SetTiedVariable = \&Wx::TiedVariable::Set; Then > you could just use $widget->SetTiedVariable(\$value); I just didn't know at > what point in the hierarchy GetValue and SetValue became active. They are just for TextCtrl (well, and some other control has them, too); it is probably easier to have an arbitrary method (say, FooBar), implemented differently for each control, and use this method; e.g. *Ctrl1::Foobar = sub { one impl } *Ctrl2::FooBar = sub { other impl } And Wx::TiedVariable::Set calls FooBar instead of SetValue. Regards Mattia |