Queries on tree items and signals



Hi,
I am new to the list and I have a couple of queries on the following:

1. Signals and callback functions.
I have a requirement in which I have to a function like below:

sub display_type {
                                                                                
my ($tree, $ext_name, $help) = @_;

$::button_ok->signal_handlers_destroy();
$::button_cancel->signal_handlers_destroy();
                                                                                
                                                                                
$::button_ok->signal_connect( 'clicked', \&type_direct_apply,$tree,$::external_text,$help_text);

$::button_cancel->signal_connect( 'clicked', \&type_sample_cancel,$tree, $::external_text,$help_text );
                                                                                
}

sub type_direct_apply {
                                                                                
my ($button, $tree, $external, $help) = @_;
#Some validation checks here...
#Based on the validations some new display values to be entered...
display_subtype($tree, $externalname_text, $help_text);

}




$::button_ok and $::button_cancel are global widgets and 
they call the signal connect functions type_direct_apply and type_direct_cancel

In these functions(say type_direct_apply), I do some validations and call 
the display_type again(to display the newly entered values in the GUI layout).

Whenever the $::button_ok is clicked once, the program goes into an infinite loop due to the signal_connect 
of the buttons(type_direct_apply is called and then display_subtype back to type_direct_apply and so on due 
to the signal connect function).

I stopped the infinite loop by calling the signal connect functions for the buttons only once but the problem 
is the apply and cancel functions are called
with the first values of the arguements when they were created.

Can someone throw light on why it keeps calling the signal connect functions
endlessly when $button_ok is clicked on once?

Is there any way out of this loop?



2. THis is on dynamically changing labels of tree items.
When you create a tree item the first time and when selecting that tree item,
I want the user to change the label of the tree item on the fly.
Is that possible? What commands to be used for the same?


Your inputs are appreciated since I am stuck with the above 2 and not able to proceed.

Thanks
Ashwin






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]