View Full Version : Need help on helpLine; command in UI
09 September 2010, 04:16 PM
Hi there - I create a few mel scripts to help the creation of dedicated shading networks on a project.
My problem is that since I added the helpLine in the dialogs, it is gone in Maya's main window. The user has to quit Maya to get it back.
Is there a way to tell the helpLine that it should re-appear in the main window again once the dialog closes? Or is there a way to really kill the window and tell Maya to re-initialize the helpLine?
Any tip is really appreciated here because my option is to leave the helpLine where it is. But this area might be covered by another dialog or window...
// Check if window is up. If so - kill it.
if (`window -exists NYWF_createTestScene`)
deleteUI NYWF_createTestScene ;
// Creating the window.
window -sizeable true -menuBar false -w 460 -h 210 -title "Create Test Scene" NYWF_createTestScene ;
// Defining the basic layout.
columnLayout -rowSpacing 10 -width 460 -height 100 -columnAlign "left" main ;
frameLayout -collapsable false
-label "Choose what should be created"
// The radio buttons.
radioButtonGrp -numberOfRadioButtons 2
-label "Create Camera"
-annotation "Creates a camera and positions it in space."
-labelArray2 "Yes" "No" createCamera ;
// Adding another layout containing the "GO" and the "Cancel" button.
rowColumnLayout -numberOfColumns 2 -width 260 -columnSpacing 1 200 -columnSpacing 2 30 buttons ;
button -label "GO" -w 226 -command "testForUserSelection() ;" ;
button -label "Cancel" -w 226 -command "deleteUI NYWF_createTestScene ;" ;
setParent main ;
frameLayout -labelVisible false
-width 451 ;
09 September 2010, 04:11 AM
Looks like a bug in Maya's helpLine command. It steals the control of helpline away from the main UI so you will need to rebuild that default UI.
You can either try sourcing this file:
Or if you want to add the relevant conent from the script above directly into your script:
global string $gHelpLineForm;
global string $gMainProgressBar;
string $helpLine = `frameLayout -parent $gHelpLineForm -borderVisible true -borderStyle "in" -labelVisible false
-collapse false -collapsable false`;
string $innerForm = `formLayout -parent $helpLine`;
string $helpControl = `helpLine -annotation (uiRes("m_initHelpLine.kHelpLineAnnot"))`;
$gMainProgressBar = `progressBar -isMainProgressBar true -visible false -width 1 -height 10 mainProgressBar`;
formLayout -edit -af $helpControl "top" 0 -ac $helpControl "left" 0 $gMainProgressBar
-af $helpControl "bottom" 0 -af $helpControl "right" 0 -af $gMainProgressBar "left" 2
-af $gMainProgressBar "top" 4 -af $gMainProgressBar "bottom" 3
-an $gMainProgressBar "right" $innerForm;
formLayout -edit -attachForm $helpLine "top" 0 -attachForm $helpLine "left" 1 -attachForm $helpLine "bottom" 0
-attachForm $helpLine "right" 0 $gHelpLineForm;
setUIComponentStateCallback("Help Line", "helpLineVisibilityStateChange");
setHelpLineVisible(`optionVar -query helpLineVisible`);
I hope that helps!
09 September 2010, 09:00 AM
Does the helpline even do anything other than echo the same annotations that are already displayed via tooltips..? for all the hassle it looks like this will entail I'd ditch helpLine and just rely on the built-in tooltips for your annotation help...
09 September 2010, 04:15 PM
Thanks for the replies.
Chris: "source initHelpLine" or works as it seems. I hope this will presist in Maya 2011 and QT but it's mel. Should persist.
Nathan: By tooltips you mean the text that floats above on yellow or white background?
Because that's what I initially wanted to do but I could not figure out how to get that going in mel in my own dialog. Bringing the helpLine into the dialog seemed like a good idea since some people (including me) cover the helpLine by floating the hypershade, action window etc. above the Maya main window. Some sort of Power Animator deformation I believe...
Thanks for the help guys - really appreciated!!
09 September 2010, 04:25 PM
Hey Alex, you shouldn't have to do anything at all to get tooltips, only add an -ann flag to the control. any control with an annotation will display it as a tooltip when you hover over it. If it's not automatically doing that for you you may have tooltip help turned off in your prefs? (Window > Settings/Prefs > Preferences > help)
09 September 2010, 05:15 PM
The fact that they are almost identical is probably why autodesk doesnt worry about fixing this bug.
09 September 2010, 06:09 PM
wow. indeed. I had them turned off. Isn't it amazing that the biggest bug of any software is 2 feet in front of the screen. I am copying my prefs since Maya 2.5 or something. It might be time to rebuild them...
In fact I am having trouble running the "source initHelpLine". It seems that the main script just stops if it hit's that source command. I also tried to put it into separate procedure. To no avail. It doesn't continue after the sourcing. I am sure I'm doing something wrong.
But, since tooltips seems to exactly be doing what I want I will get rid of that helpLine in my dialogs.
I will make sure tooltips are turned on in the prefs on and worst case notify the user.
Thanks again - appreciated!
09 September 2010, 06:52 PM
if you want to be ultra-safe you could always just force the tooltips to be on at the top of your script!
help -popupMode on;:nathaN
09 September 2010, 11:50 PM
Oups... double post... sorry
09 September 2010, 11:57 PM
Thanks again for the help! I thought I post how I solved and implemented it.
I decided to let the user chose if he/she want's to switch the tooltips on. Might be overkill and obsolete, but some people are picky about their application settings...
// Query the Maya preferences for tooltips settings
int $helpPopUpState = `optionVar -q popUpHelpMode` ;
if ($helpPopUpState == 0)
string $tooltipsStateDialog = `confirmDialog -t "Maya Tooltips Off" -b "Switch On" -b "Leave Off" -db "Switch On" -cb "Leave Off" -ma "center" -m ("Maya Tooltips are switched off." + "\n" + "Find Settings in: Window \-\> Settings/Prefs \-\> Preferences \-\> help" + "\n" + "\n" + "OR")` ;
if ($tooltipsStateDialog == "Switch On")
// Switch the tooltips on
help -popupMode true;
print ("User decided to switch tooltips on" + "\n" + "\n") ;
else if ($tooltipsStateDialog == "Leave Off")
print ("User decided to leave tooltips switched off" + "\n" + "\n") ;
print ("Tooltips were already switched on" + "\n" + "\n") ;
09 September 2010, 11:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.