View Full Version : creating help button
05-09-2008, 11:10 AM
Hi everyone :)
I want to provide some info for the user of my dialog, like a guidance with using the dialog.
The first thing I thought of was to have a functionality like the "?" button on some M$ dialogs, where when pressed and you click on dialog elements, it shows you information what they are and so on.
For this to achieve, I tried to use the tool function, but I have no clue how to get back the dialog control.
Is there a function I can use to get controls at a specific position?
I hoped the "toolTip" property would work for more than just buttons in maxscript, but then I thought, it is rather limited with just text...
So I want to create a function which shows up another dialog to the left or right of the dialog control, show information about it, when hovering out or to some other control, the information dialog disappears and another one will open with updated info on the new dialog control.
The only problem I have to achieve this, I don't know how to get the dialog control on the specific position. (I have about 100 dialog controls I need to document...)
Thanks for any help! :)
05-09-2008, 12:00 PM
Something like this?
rollout r1 "Tool" width:200 height:300 (local test)
rollout r2 "Help" width:400 height:500 (local test)
pos = getdialogpos r1
size = getdialogsize r1
setdialogpos r2 (pos + [6,0] + (size * [1,0]))
I'd probably put an AX HTML controll in there, and just have all the help in one page, then you just call the "navigate" method of teh control to go the correct bit
05-09-2008, 12:01 PM
unfortunately, you can't - unless you make your entire dialog out of .NET controls -or- use some funny .NET access to get the dialog and each control within (I think it's possible by calling the system DLL somehow, but I sure haven't tried).
Presuming the above to not be an option... you can't.
I coded a 'tooltip' thing for all our scripts to provide tooltips (which could be non-text) for every control inside a dialog. The way I went about it is to have an array that describes each control's position and dimensions in a Box2 value. After that it's just a matter of getting the mouse's position within a dialog, checking if that point is in one of those Box2's ('contains' function), and if it is - pop up the correct dialog with the tooltip temporarily.
Pitfalls, off the top of my head...
- you can't always get the position of the mouse within a dialog; i.e. not when over certain controls. You will have to relate the mouse's -screen- position to the dialog's position on screen, and derive the coordinates of the mouse within the dialog that way. Keep in mind that some users might have taller titlebars or thicker borders. Easiest solution there is to do a one-time calibration by using a part of the dialog that -does- return the dialog coordinate positions and look up the screen position that goes with that.
- opening a dialog causes your original dialog to lose focus. As you mentioned the use of the [?] button, this is not so much an issue for you - for automated mouseover tooltips, this can be annoying because users editing text fields might suddenly find themselves typing into nothingness as the tooltip dialog takes focus. This can be coded around for the most part.
The only reason I'm using that array of Box2 values (and associated tooltip definitions) is because you cannot get the width and height of every control. You can get the position, but that's only half of what you need and, sadly, insufficient.
It's not too bad, though - depending on how you wrote your rollout (absolute positions vs offsets), getting the coordinates and dimensions of your controls is quite doable. It's a bit of work, but it's typically something you only have to do when you add/remove/move controls.
05-09-2008, 12:30 PM
Regarding Richard's post of not being able to get the positions (I guess i didn't fully understand your question!) another approach might be to have one Help button that opens an HTML page in a rollout, as I suggested.
Then, at the top of this HTML page you have an image of the rollout with clickable regions defined over the controls and buttons. Each region would be linked to another area in the page using anchors, and when the user clicks, the page jumps to that bit of text.
A few other ways you could do it as well (frames, AJAX), but if you're not that skilled in the ways of web development, that would be a good place to start.
I actually have some examples of this on my hard drive, but I've yet to upload them. However, I'm having a couple of days updating my site so I'll post back here when examples are up.
Hope that helps,
05-13-2008, 12:04 PM
It seems there is no better way than to have every position of each rollout control checked and if some positions match or are in range of the mouse, it displays a different rollout.
Or I create a help button for each rollout, explaining how things are done and so.
Well, how do you implement html code into the script?
Or is it better to use .chm help files?
05-13-2008, 12:17 PM
There's really many approaches - given here and in the duplicate thread, ranging from fancy and difficult to "press a button and pop up the help file"; and there's nothing wrong with the latter, that's how all of 3ds Max's documentation (short of a few choice interfaces) works.
If you want to place an HTML page in a rollout, you'll have to use either ActiveX (pre-R9) or .NET (post-R9) to create a browser control within the rollout.
See the MaxScript help topics for details:
ActiveX: Internet Explorer ActiveX Control
.NET: Creating A Simple Web Browser Using DotNet
05-13-2008, 12:17 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.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.