Problem with OpenFileEntry API

User: "Jeffersondhv"
Altair Community Member
Updated by Jeffersondhv

Hello all,

 

I'm trying to create a user interface on HM where the user can input a file and some other options to run a code.

To retrieve the file path I'm using the command hwtk::openfileentry, using a -textvariable option to retrieve the input.

However when I try to use the variable saved from the input it's not changing at all.

The fix should be simple, but I'm not being able to make this work.

 

Here follows the code I'm using:

 

  if { [winfo exist .geom_checker] } { 	destroy .geom_checker; }  set textVar 'Nothing'  set f .geom_checker frame $f  set w [hwtk::frame $f.w] pack $w -anchor nw  set top [frame $f.top]; pack $top -side top -fill x -expand 0; set bottom [frame $f.bottom]; pack $bottom -side bottom -fill x -expand 0;  # Return button button $bottom.button -text 'return' -command hm_exitpanel -bg #C06060; pack $bottom.button -side right -anchor e -ipadx 6 -ipady 4  # ------- REFERENCE FILE # Label frame for Reference File set lbl_ref [hwtk::labelframe $w.title_ref -text 'Reference STP File'] grid $lbl_ref -column 0 -row 0 -ipadx 6 -ipady 6 # pack $lbl_ref -side left -anchor nw -pady 4  set txt_file 'Open file' hwtk::label $lbl_ref.l -text $txt_file hwtk::openfileentry $lbl_ref.e -textvariable textVar grid $lbl_ref.l -column 0 -row 0 -sticky w -pady 2 -padx 5 grid $lbl_ref.e -column 1 -row 0 -sticky w -pady 2 -padx 5 #grid configure $lbl_ref.e -sticky ew   set cmd_btn 'tk_messageBox -message $textVar -type ok' button $lbl_ref.import_ref -text $textVar -command $cmd_btn -bg #60C060 grid $lbl_ref.import_ref -column 2 -row 0 -sticky e -pady 2 -padx 5  button $bottom.run -text 'Proceed' -command hm_exitpanel -bg #60C060; #grid $top.run -column 10 -row 0 -sticky e pack $bottom.run -side right -anchor ne -ipadx 6 -ipady 4  hm_framework addpanel $f 'Model Info'; hm_framework drawpanel $f;

Thanks in advance,

Jefferson Vieira

Find more posts tagged with