Page 1 of 1

LM.GUI.???

Posted: Tue Nov 16, 2004 6:28 am
by sherlock
I was wondering, in addition to the following:

Menu
PopupMenu
CheckBox
Button
StaticText
DynamicText
TextControl
PopupDialog

Are there other graphic controls available? In particular, I would like to know about a combobox, radio buttons, and/or some sort of slider type control for quickly adjusting integer and float values.

Thanks,
HL

Posted: Tue Nov 16, 2004 7:26 am
by AcouSvnt
Lua doesn't distinguish between floats and integers.

Posted: Tue Nov 16, 2004 9:04 am
by 7feet
...But the Moho Lua API does. For input or display, the GUI can be configured to input signed or unsigned float and integer values(thanks, LM!). The "Explosion" Menu script has an example of the "AngleWidget", which uses the same sort of knobs used for the directions in Particle layers. Even though it's outputting angles, a kinda kludgy(because I don't think you can get rid of the angle display below the knob) general solution would be to take it's output , convert it to the type of number you want, and drop that into a text field. The "Smoke" script (these are all in the Scripts>Particle Effects folder) is a good example of how to set up radio buttons. For quick adjustment, you can set an increment for mouse wheel adjustment, heres a snippet from the Bone Strength tool:

self.strength = LM.GUI.TextControl(0, "00.0000", self.CHANGE, LM.GUI.FIELD_UFLOAT)
self.strength:SetWheelInc(0.1)

Actually, that shows you how to define the values, too. The text field can be FLOAT, UFLOAT, INT, or UINT. I don't think there's any provision for comboboxes, but you could always add a list of common values into a popup menu. Also, I haven't tried it, but I'm sure you could draw sliders for use in the main window the same way that the various crosshairs and selection markers are, and detect when the mouse is inside them. You'd have to do some extra coding, but I suspect it's entirely possible. Kind up "heads-up display" style.

If you haven't gotten it yet, you should get the modified API script that Myles did, adress in this post. Outputs a nicely formatted copy of the API in HTML. I have a printout from it I refer to all the time.

--Brian

Posted: Tue Nov 16, 2004 9:36 am
by AcouSvnt
Oh, I guess it would have to, wouldn't it ... because Moho isn't a Lua program, it's a C++ program with a Lua interface. Duh, sorry. :oops:

Posted: Tue Nov 16, 2004 10:14 am
by 7feet
Well, dunno if it would have to. Since Lua was written expressly to work with C, and it's so "whatever" about typing, it's a wonder they can get along in the first place.

--Brian