Management of GUI window elements
Hello all,
I need a simple script that controls GUI elements (buttons, scrollfields, pictures) in main window from external procedure. Below the code.
global proc WindowGUI()
{
if (`window -exists WindowGUI`) deleteUI WindowGUI;
window -t "Window GUI Form" -widthHeight 300 300 -rtf true -sizeable false WindowGUI;
string $form = `formLayout`;
string $BackgroundImage = ` picture -width 300 -height 300 -image "Background.png"`;
string $SelectionScrollField = `scrollField -wordWrap false -w 200 -h 200 -cl -enable false -editable false`; // clear field
string $Button_ShowText = `button -label "Show text on Form" -w 160 -h 25 -command ShowTextOnForm Button_ShowText`; // Button exec procedure ShowTextOnForm
formLayout -edit
-attachForm $SelectionScrollField "top" 50
-attachForm $SelectionScrollField "left" 50 // paste panel on form
-attachForm $Button_ShowText "top" 260
-attachForm $Button_ShowText "left" 70 // paste button on form
$form;
showWindow WindowGUI;
}
global proc ShowTextOnForm()
{
//?! There will be a code for management of a field
}
WindowGUI;
1)I need to execute external procedure (ShowTextOnForm) which changes an interface element on pressing of the button, for example adds the text in the scrollField.
2)If it is possible, whether there is a need to kill and redraw a window each time at change of any element.
3)how to address directly to any element of a window (for example something like that: WindowGUI.scrollfield1.text)?
Thanks for your help