Note that there are some explanatory texts on larger screens.

plurals
  1. POUnderstanding name spaces in POE-Tk
    primarykey
    data
    text
    <p>I posted <a href="https://stackoverflow.com/questions/1145532/"> "How to undersand the POE-Tk use of destroy?"</a> in an attempt to reduce the bug in my production code to a test case. But it seems that the solution to the test case is not working in the full program.</p> <p>The program is 800+ lines long so I am hesitant to post it in full. I realize that the snippets I provide here may be too short to be of any use, but I hope to get some direction in either where to look for a solution or what additional information I can provide.</p> <p>Here is the Session::Create section of my POE-Tk app.</p> <pre><code> POE::Session->create( inline_states => { _start => \&ui_start, get_zone => \&get_zone, ping => \&ping, mk_disable => \&mk_disable, mk_active => \&mk_active, pop_up_add => \&pop_up_add, add_button_press => sub { my ($kernel, $session, $heap) = @_[KERNEL, SESSION, HEAP]; print "\nadd button pressed\n\n"; &validate; }, ih_button_1_press => sub { my ($kernel, $session, $heap) = @_[KERNEL, SESSION, HEAP]; print "\nih_button_1 pressed\n\n"; if( Tk::Exists($heap->{ih_mw}) ) { print "\n\nih_mw exists in ih_button_1_press\n\n"; } else { print "\n\nih_mw does not exist in ih_button_1_press\n\n"; } 1; $heap->{ih_mw}->destroy if Tk::Exists($heap->{ih_mw}); &auth; }, pop_up_del => \&pop_up_del, auth => \&auth, # validate => \&validate, auth_routine => \&auth_routine, raise_widget => \&raise_widget, del_action => \&del_action, over => sub { exit; } } );</code></pre> <p><code>add_button_press</code> is called here;</p> <pre><code> sub pop_up_add { ... my $add_but_2 = $add_frm_2->Button( -text => "Add Record", -command => $session->postback("add_button_press"), -font => "{Arial} 12 {bold}") -> pack( -anchor => 'c', -pady => 6, ); ... }</code></pre> <p>validate creates the Toplevel widget $heap->{ih_mw};</p> <pre><code> sub validate { ... if( ! $valid ) { print "\n! valid entered\n\n"; $heap->{label_text} .= "Add record anyway?"; my $lt_ref = \$heap->{label_text}; ... my $heap->{ih_mw} = $heap->{add_mw}->Toplevel( -title => "ih_mw"); ... if( Tk::Exists($heap->{ih_mw}) ) { print "\n\nih_mw exists in validate\n\n"; } else { print "\n\nih_mw does not exist in validate\n\n"; } ... my $ih_but1 = $heap->{ih_mw}->Button( -text => "Add", -font => 'vfont', -command => $session->postback("ih_button_1_press"), )->pack( -pady => 5 ); ... }</code></pre> <p>Pressing $ih_but1 results in this;</p> <p><code>C:\scripts\alias\resource&gt;alias_poe_V-3_0_par.pl</code></p> <p>add button pressed</p> <p>sub validate called</p> <p>! valid entered</p> <p><code>ih_mw</code> exists in validate</p> <p><code>ih_button_1</code> pressed</p> <p><code>ih_mw</code> does not exist in <code>ih_button_1_press</code></p> <p>So the <code>$heap-&gt;{ih_mw}</code> widget seems to be unkown to the <code>ih_button_1_press</code> anonymous subroutine even with the inclusion of "<code>($kernel, $session, $heap) = @_[KERNEL, SESSION, HEAP];</code>"</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload