Entry event

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hello everyone, 

 

I have a problem when I try to launch an action after a change of my entry. My entry is define by :


set listing [list '0' '1' '2' '3' '4'];
set entry2 [hwt::AddEntry $frame2.entry2 \
label 'Choose :' \
labelWidth $labelWidth \
entryWidth 20 \
listVar fromPopDown noTyping [namespace current]::listing \
state normal \
anchor nw \
validate real \
text '0' \
textvariable variablePicked \
selectionFunc {tk_messageBox -message 'Changed !!!!'}];
pack $entry2 -side top -anchor nw;

I was in HW GUI ToolKit some function as selectionFunc but It doesn't work ! May somebody have any ideas ?

 

Thank you a lot for your help 

Answers

  • Rahul Rajan_21763
    Rahul Rajan_21763 New Altair Community Member
    edited June 2015

    Hi,

    Could you explain your requirement in detail?

    Regards

    Rahul R

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2015

    Hello Rahul R, 

     

    Thank you for your help ! So here is my example interface :


    proc interface {} {
    global listing
    set myTopLevel [hwt::CreateWindow mytoplevel -windowtitle 'Window' -minsize 500 375 -post];
    set recess [hwt::WindowRecess mytoplevel];
    set section [LabeledFrame $recess.constructeur 'Section' -topPad 5 -bottomPad 5]
    pack $section -side top -anchor nw -fill both -expand 1;
    set frame1 [frame $section.frame1];
    pack $frame1 -side top -anchor nw -expand 1;
    hwt::AddPadding $frame1 -side left -width [hwt::DluWidth 4];
    set listing [list '0' '1' '2' '3' '4'];
    set entry2 [hwt::AddEntry $frame1.entry1 \
    label 'Make a choice :' \
    labelWidth 30 \
    entryWidth 20 \
    listVar fromPopDown noTyping [namespace current]::listing \
    state normal \
    anchor nw \
    validate real \
    text '0' \
    textvariable Piece \
    listProc messageBox];
    pack $entry2 -side top -anchor nw;
    }

    proc messageBox {} {
    tk_messageBox -message 'Changing !!!!'
    }

    interface

    So with this code sample, I would like to launch a message box as soon as my value in my textbox changed. 

     

    But as far as i have is only when I click my box.

     

    Do you any idea to solve this ?

  • tinh
    tinh Altair Community Member
    edited June 2015

    Hi,

    You can do it by using tcl tracer

    trace add variable Piece write messageBox

    rewrite messageBox procedure with optional arguments

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2015

    Ok thank you but because I'm a beginner, could you tell me how to do it ?

    Thanks a lot for your help

  • tinh
    tinh Altair Community Member
    edited June 2015

    Hi

    Usage of trace command is here:

    http://www.tcl.tk/man/tcl8.5/TclCmd/trace.htm