hello,
is it possible to find a wx-component by it's name or ID ?
And if so, can I limited the search to components within a specified parent ?
thanks,
Stef Mientki
hello,
is it possible to find a wx-component by it's name or ID ?
And if so, can I limited the search to components within a specified parent ?
thanks,
Stef Mientki
Yes. What's the context?
Rich
On Sun, 21 Oct 2007, Stef Mientki wrote:
is it possible to find a wx-component by it's name or ID ? And if so, can
I limited the search to components within a specified parent ?
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerators(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
Rich Shepard wrote:
is it possible to find a wx-component by it's name or ID ? And if so, can
I limited the search to components within a specified parent ?Yes.
thanks Rich,
Aha, that was the wrong question
What's the context?
I catch a group of events within the same event handler.
Then I want to ask the sender of the event,
what type it is,
and then I want to take the appropriate action.
And there are numerous other applications,
in Delphi I use it very regular.
So the questions are:
How can I find a component by it's ID (annd limit the search to a specified parent) ?
How can I find a wx-component, in a specified parent/container, by it's name ?
cheers,
Stef Mientki
On Sun, 21 Oct 2007, Stef Mientki wrote:
Rich
So the questions are:
How can I find a component by it's ID (annd limit the search to a specified parent) ?
How can I find a wx-component, in a specified parent/container, by it's name ?
Stef, I find windows by label, and I find that extremely handy. I simply use .SetLabel('the label') on the windows I need to find, and
wx.FindWindowByLabel('the label') elsewhere.
And wx.FindWindowByLabel has a second, optional argument, the "parent"; if present, the search will be limited, as the help text states, to the given window hierarchy.
The labels I create reflect the hierarchy of my =data=; the window hierarchy can be completely different. As needs arise for me to change my applications' layouts, I rarely need to change anything relating to data access. But you know all that, having used this kind of technique in Delphi.
FindWindowById and FindWindowByName also exist, and they too carry the second optional argument. But, for me at least, finding by label is by far the most flexible. (BTW, FindWindowByName will call FindWindowByLabel if the searched-for name is not found.)
Bob
P.S. I'm curious: how come you switched from Delphi to wxWindows? I'm guessing it was primarily a financial decision.
At 02:10 PM 10/21/2007, Stef Mientki wrote:
Stef,
Perhaps the more expert users on this list can provide a more specific
answer to those two questions, but I offer a suggestion that may work as
well, or better, for you. For context, understand that I've never used
Delphi; tried learning Borland Pascal back in the 1980s but went with C
instead, and I've used only linux the past decade.
Given that, what seems to be the wxPython approach is to bind event or
command handlers to each widget. For example, scroll bars have these events:
EVT_SCROLL
EVT_SCROLL_BOTTOM
EVT_SCROLL_ENDSCROLL
EVT_SCROLL_LINEDOWN
EVT_SCROLL_LINEUP
EVT_SCROLL_PAGEDOWN
EVT_SCROLL_PAGEUP
EVT_SCROLL_THUMBRELEASE
EVT_SCROLL_THUMBTRACK
EVT_SCROLL_TOP
These cover the most frequent events related to a scroll bar. They would
be bound to the specific scroll bar by the widget's name, but multiple
events can call the same handler. As a matter of fact, if you have several
scroll bars on the panel, you can abstract the common elements of their
handlers and have the widget-specific methods call the common function.
Applying this approach lets the library match methods to widgets.
HTH,
Rich
On Sun, 21 Oct 2007, Stef Mientki wrote:
I catch a group of events within the same event handler. Then I want to
ask the sender of the event, what type it is, and then I want to take the
appropriate action.
So the questions are:
How can I find a component by it's ID (annd limit the search to a specified parent)?
How can I find a wx-component, in a specified parent/container, by it's name?
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerators(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
Stef Mientki wrote:
Rich Shepard wrote:
is it possible to find a wx-component by it's name or ID ? And if so, can
I limited the search to components within a specified parent ?
child = parent.FindWindowById(theID)
or
child = parent.FindWindowByName(theName)
Yes.
thanks Rich,
Aha, that was the wrong questionWhat's the context?
I catch a group of events within the same event handler.
Then I want to ask the sender of the event,
what type it is,
and then I want to take the appropriate action.
In most cases you can get the object that the event was sent from (or in behalf of) using:
source = event.GetEventObject()
On Sun, 21 Oct 2007, Stef Mientki wrote:
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
thanks Robin,
that's about everything I need.
cheers,
Stef Mientki
Robin Dunn wrote:
Stef Mientki wrote:
Rich Shepard wrote:
On Sun, 21 Oct 2007, Stef Mientki wrote:
is it possible to find a wx-component by it's name or ID ? And if so, can
I limited the search to components within a specified parent ?child = parent.FindWindowById(theID)
or
child = parent.FindWindowByName(theName)Yes.
thanks Rich,
Aha, that was the wrong questionWhat's the context?
I catch a group of events within the same event handler.
Then I want to ask the sender of the event,
what type it is,
and then I want to take the appropriate action.In most cases you can get the object that the event was sent from (or in behalf of) using:
source = event.GetEventObject()
sorry guys,
forgot to thank Bob and Rich.
cheers,
Stef
Stef Mientki wrote:
thanks Robin,
that's about everything I need.
cheers,
Stef MientkiRobin Dunn wrote:
Stef Mientki wrote:
Rich Shepard wrote:
On Sun, 21 Oct 2007, Stef Mientki wrote:
is it possible to find a wx-component by it's name or ID ? And if so, can
I limited the search to components within a specified parent ?child = parent.FindWindowById(theID)
or
child = parent.FindWindowByName(theName)Yes.
thanks Rich,
Aha, that was the wrong questionWhat's the context?
I catch a group of events within the same event handler.
Then I want to ask the sender of the event,
what type it is,
and then I want to take the appropriate action.In most cases you can get the object that the event was sent from (or in behalf of) using:
source = event.GetEventObject()
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org