Page 1 of 1

How to create the image on a field dialogbox?

Posted: Sun Sep 26, 2004 2:30 pm
by maxic
How to create the image on a field dialogbox?

Re: How to create the image on a field dialogbox?

Posted: Mon Sep 27, 2004 1:05 am
by myles
maxic wrote:How to create the image on a field dialogbox?
I assume you are talking about a preview image, such as the star shape shown here:
Image

See the sample scripts lm_star.lua or lm_polygon.lua for details.

As I understand it, you need to add a mesh preview in your dialog definition:

Code: Select all

	d.preview = MOHO.MeshPreview(200, 200)
	l:AddChild(d.preview)
Add an update function that redraws your shape in the preview:

Code: Select all

function LM_PolygonDialog:UpdatePreview()
	local mesh = self.preview:Mesh()
	mesh:Clear()

	local numPoints = self.numPoints:IntValue()
	numPoints = LM.Clamp(numPoints, 3, 20)

	LM_Polygon:BuildPolygon(mesh, numPoints)
	self.preview:CreateShape(true)
	self.preview:Refresh()
end
and call the update function at the appropriate times (when updating widgets, handling messages, etc.):

Code: Select all

		self:UpdatePreview()
Regards, Myles.

Thanks, it I too looked in examples

Posted: Mon Sep 27, 2004 8:22 am
by maxic
It is necessary BITMAP

Posted: Mon Sep 27, 2004 8:04 pm
by Lost Marble
Not possible at this time.

Posted: Thu Sep 30, 2004 2:23 pm
by maxic
And in the future it is planned? :?:

Posted: Thu Sep 30, 2004 6:26 pm
by Lost Marble
maxic wrote:And in the future it is planned? :?:
Maybe. There are certainly lots of ways to imrpove the Lua scripting capabilities.