Re: Perl Tk:Scheduler command called subroutine fails to talk to tk widgets



"Andy" <anedza@xxxxxxxxxxxxxxxxxxxxxx> writes:

Does anyone know why? Do I have to call some sort of "refresh" tk
command or release tk resources?

Have you tried with an anonymous sub ? This sub is stored inside a
lexical variable so there's no problem with namespace.

I.e. (untested) :

use Tk;
use Tk::Schedule;

my $mw = MainWindow->new;

my $txtbox ; # variable declared before anon sub creation

my $run = sub {
print "start run\n";
$txtbox->insert(end,"this just hangs\n");
print "exit run\n";
} ;

my $s = $mw->Schedule(
-interval => 60,
-repeat => "once",
-command => [ $run, "junk"],
-comment => "1-9999"
)->pack();

$txtbox=$mw->Text(-width => 79,
-height => 8,
)->pack();

$txtbox->insert(end, "this works\n");

MainLoop;

# HTH

--
Dominique Dumont
"Delivering successful solutions requires giving people what they
need, not what they want." Kurt Bittner
.



Relevant Pages

  • Re: Garbage Collection
    ... If you can explicitly call Dispose, it is always best to do this as this ... provides timely release of resources the object may be holding onto. ... > Sub Internal1() ...
    (microsoft.public.dotnet.languages.vb)
  • Re: MissingManifest Error in VB
    ... > Hi Daniel, ... >> debugger for the real names of your resources ... >>> Dim rm As System.Resources.ResourceManager ... >>> Public Sub New ...
    (microsoft.public.dotnet.framework.compactframework)
  • RE: Memory leak with Datagrid and array
    ... So, I close, dispose and set the datagrid=nothing. ... The .net help says "When a form is closed, all resources created within the ... > Matrix_A.DisposeThe data is still in the datagrid so do not forget to set ... >> Private Sub OpenA() ...
    (microsoft.public.dotnet.languages.vb)
  • Re: MissingManifest Error in VB
    ... The 2 real name of resources are: ... "Daniel Moth" wrote: ... >> Public Sub New ... >> Private Sub MenuItem2_Click(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.framework.compactframework)
  • GC and Dispose method questions
    ... understand the basic definition for managed resources are resources that the ... CLR manage and unmanged resources are resources that the CLR doesn't manage, ... Public Class Base ... Public Overloads Sub Dispose() Implements IDisposable.Dispose ...
    (microsoft.public.dotnet.languages.vb)