Re: Suggestions

Hi Budman,

budman wrote:

how to create signals from the main module (like using
a tree or ctree widget filling up with folder names) for widgets on the
forms.  How do you know when to use the $form or the name of the package?
When I use a dynamically updated CTree I add a 'button_press_event'
handler to the ctree and store all the relevant data for the tree node in
a global hash $ctreenodes (keyed by the widget). eg:
  $leafnode = $ctree->insert_node(
    $rootnode, undef,
     '', ''], 
    0, undef, undef, undef, undef, '0', '1');
  $ctreenodes->{$leafnode} = {
    'ctreenode' => $leafnode,
    'type'      => $proto->{'type'},
    'path'      => $proto->{'path'},
    'detail'    => $proto->{'detail'},
    'link_text' => $proto->{'link_text'},
    'parent'    => $parent,

I then have a handler like:

sub on_ctree1_button_press_event {
    my ($class, $mydata, $object, $instance, $e) = @_;
    return 0 unless $class->selection;
    my ($row, $col);
    my $form = $__PACKAGE__::all_forms->{$instance};
    my $ctree = $form->{$object};
    ($row, $col) = $ctree->get_selection_info($e->{'x'}, $e->{'y'});
    $ctree->select_row($row, 0);
    # Get back the global data for this ctreenode
    my $d = $ctreenodes->{$ctree->selection};

    if ($e->{'button'} == 1) {
        $form->load_html($form, $d->{'path'})
            if ! $d->{'type'} and $d->{'path'};
    } elsif ($e->{'button'} == 3) {
        $ctree_right_menu ||= new ctree_right_menu;


CountZero <countzero cyberdeck org> originally suggested this way.

Although there is probably a 'more proper' way to do it - it works.

HTH, Dermot

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