Hi all,

I try to migrate an existing script from win32-gui
558 to 665. One show-stopper I came upon was that
no NodeClick events are generated by a tree view
control if it is child of a tab strip control.

Everything works as advertised when the tree view
is the main window's child.

There's no 665 specific stuff (like the new
event model), see code below.

Any magic involved I am not aware of? Thanks for
your ideas!

Cheers
  Peter

---8<-------------------------------------8<---
use Win32::GUI;
$Window = new GUI::Window(
    -name   => "Window",
    -text   => "Win32::GUI TEST - TreeView",
    -left   => 0, 
    -top    => 0,
    -height => 200, 
    -width  => 250,
);
$Tab = $Window->AddTabStrip(
    -name   => "Tab",
    -left   => 10,   
    -top    => 10, 
    -width  => 200, 
    -height => 150,
);
$Window->Tab->InsertItem(
    -text => "First", 
);

$TV = $Tab->AddTreeView(
    -name      => "Tree",
    -width     => 150, 
    -height    => 100,
    -left      => 20, 
    -top       => 40,
    -lines     => 1, 
    -rootlines => 1,
    -buttons   => 1,
);
$TV1 = $TV->InsertItem(
    -text          => "ROOT", 
);
$TV3 = $TV->InsertItem(
    -parent        => $TV1, 
    -text          => "SUB 1", 
);
$TV2 = $TV->InsertItem(
    -parent        => $TV1, 
    -text          => "SUB 2", 
);
$Window->Show();
Win32::GUI::Dialog();

sub Window_Terminate {
    $Window->PostQuitMessage(0);
}
sub Tree_NodeClick {
    my %node = $TV->GetItem($_[0]);
    print "Click on node '$node{-text}' \n";
    return 1;
}
sub Exit_Click {
    $Window->PostQuitMessage(0);
}
---8<-------------------------------------8<---

Reply via email to