Re: problem with accessing a widget from outside of signal handler subs
- From: Dermot Musgrove <dermot glade perl connectfree co uk>
- To: Sebastian Weitzel <sebastian weitzel fh-stralsund de>
- Cc: gtk-perl-list gnome org, togg togg de
- Subject: Re: problem with accessing a widget from outside of signal handler subs
- Date: Mon, 09 Sep 2002 03:32:35 +0100
Hi Sebastian,
I am sorry to reply so late but I have been away for a time.
Sebastian Weitzel wrote:
Hi, maybe this question is too simple for you, but i can't find it out.
I use the actual glade-perl 0.60 with glade 0.6.4 and gtk-perl 0.7008.
I generated with help of glade-perl a set of perl files. I have a tree
widget which I want to access from project.pm
The definition of the tree is in projectUI.pm , I successfully modified
the tree in signal subs in project.pm.
My problem is: I have created a package "tree" with a sub create_root( )
, which I want to run at beginning (of program execution) Where do I
have to call tree:create_root(), so that it is called at beginning?
I usually do this sort of stuff in a sub eg main::app_init() which I call
in main::app_run().
BTW I am not sure what the effects of using package 'main' for UI class
will be - can it conflict with the default perl package 'main'?
Another Problem is, I can't get reference to the tree!
I have snipped out the code to show you my problem.
[...]
in sub tree:create_root(), how can I access the 'datatree' if I don't
have know what $form is. Because all is declared as strict (my declared)
I don't have access to $form or $window.
I have temporarily "solved" the problem with delivering $form to the
sub. But this only works from locations where $form is valid. (in signal
handlers)
I can only think that you hold a global reference to the constructed
object and then use the supplied FORM() method to get at the widgets:
$window = new main;
$datatree = $window->FORM->{'datatree'};
Get back to me if I have misunderstood or not answered your question.
Regards, Dermot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]