Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Tk programmatically monitor change in Listbox

by IB2017 (Pilgrim)
on Jan 06, 2020 at 10:45 UTC ( [id://11111044]=note: print w/replies, xml ) Need Help??


in reply to Re: Tk programmatically monitor change in Listbox
in thread Tk (Tcl::Tk) programmatically monitor change in Listbox

The user will add a new element (or a set of elements) to the set of elements displayed in the Listbox. This is done programmatically. The list can be recreated with no problem at any time. The problem is that this operation is done programmatically in Tcl (embedded in Perl) through Tcl.pm/Tcl::Tk inside a

$int->Eval();#Tcl code which adds the element to the Listbox goes here

Unfortunately, me and my collegue were not able to find a way to call a Perl subrutine from inside the Eval code at the moment of adding the new element (I guess it is not possible at all). This is the reason why I am searching for an alternative to call this subrutine when the set of elements changes. It goeas without saying that for the meoment we can not substitute the Tcl code with Perl code, which would make this operation superfluous.

The original code posted in this thread is in Tk because I want(ed) to find a solution to my proposed approach - which is indipendent to Tcl.

Replies are listed 'Best First'.
Re^3: Tk programmatically monitor change in Listbox
by jcb (Parson) on Jan 07, 2020 at 02:15 UTC

    Do you need the exact changes made or do you only care about the final state? If the latter, you could simply read back the Listbox contents after the $int->Eval(); returns and call a Perl handler there.

      Unfortunately the $int->Eval(); is run upon external events (user interacting with the UI)

Re^3: Tk programmatically monitor change in Listbox
by Anonymous Monk on Jan 07, 2020 at 04:21 UTC

    The original code posted in this thread is in Tk because I want(ed) to find a solution to my proposed approach - which is indipendent to Tcl.

    Here is a rule of thumb, whenever you're 100% sure the boundary you're crossing isn't relevant, but you can't write the solution -- the boundary is critical.

    Tcl::Tk needs to be in your title to attract Courage/VKON

      Thanks for the comment. The colleague originally working on this function already posted a question regarding the possibility to call a Perl subroutine from $int->Eval(); on the tcltk@perl.org group. It seems it is possible to run Perl code from within $int->Eval(); with the Tcl command ::perl::Eval, however not a Perl subroutine that lives outside the $int->Eval();. Since I have 0 knowledge of Tcl and no experience in "language bridging", I was hoping to solve the issue simply by monitoring the change in the Listbox state/values. There are a couple of suggestion in other answers here that I am now examining.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11111044]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-25 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found