From: John H. <ec...@ya...> - 2007-06-30 12:11:29
|
Thanks for the response. Here's the code that works the best (not perfect): def on_field1_gainFocus(self, event): event.target.size=(160,event.target.size[1]) event.target.redraw() event.skip(True) return def on_field1_select(self, event): event.target.size=event.target.userdata event.target.redraw() event.skip(True) return where userdata contains the original size of the field. The above works good enough but not perfect. You know how when you click a normal combo box and the selection list pulls down? Well, with the above, the first time I click on that arrow, the combo box widens. Then I have to click it a second time for the selection list to pull down. --- Kevin Altis <al...@se...> wrote: > There are a couple of issues to deal with. Normally, > you need to have > your event handler finish before wx is going to > process the next > event. Since you want to change the component size > during the select, > the event for that would occur after your handler > finishes. On some > platforms the resize of the component is probably > deselecting the > list, though this might be a bug, I'm not sure. I > don't have your > specific code, but you probably just want to call > the redraw() method > which is defined for all components to force an > update after you > change the component size. The method as defined in > widget.py looks > like this: > > def redraw(self): > """Force an immediate redraw without > waiting for an event > handler to finish.""" > self.Refresh() > self.Update() > > You would make a call such as... > > event.target.redraw() > > If you're losing the selection after the redraw you > might be able to > do just redo the selection... > > temp = event.target.selection > # resize > # redraw > event.target.selection = temp > > something like that. Depending on the platform, it > might be necessary > to do some other tweaks. > > ka > > On Jun 29, 2007, at 5:58 PM, John Henry wrote: > > > Hi list, > > > > After I'm done with an event and I wish PythonCard > to > > continue processing that event, don't I have to > stuff > > the event back onto the event queue? > > > > For instance, let say I wish to change the width > of a > > combo box when the user click on the selection > list. > > I need to do this at run time because there is no > > space for the field at design time. So, I set up > a > > event handler for the "select" event and change > the > > width. But then if I don't do anything, the list > > won't even open right. If I do a event.skip(), > the > > field gets wider, but then I have to click on the > > selection again. So, it appears that I need to > > redispatch the "select" event after I'm done with > it. > > > > At least that's what one has to do in native > Windows > > programming. > > > > Anybody knows? > > > > Regards, > > > > > > > > > > -- > > John Henry > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 > express and take > control of your XML. No limits. Just data. Click to > get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > -- John Henry |