dotnet pick btn

how to convert this

	pickbutton pick "PickGroup" pos:[5,5] width:100 height:20 filter:filtGroup
	on pick picked destObj do if destObj != undefined do
....

to

 
	fn go_attachall_fn =
	(
		on pick picked destObj do if destObj != undefined do ...
	)
 
 
...
dotNet.addEventHandler go_attachall "CheckedChanged" go_attachall_fn

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
artrender.info's picture

thx, Barigazy

You gave me exactly what I wanted!

barigazy's picture

...

I know

;)

I hope this is the last puzzle for your tool? :)

barigazy

barigazy's picture

...

Next time prepare some example form, to be able to test code

(
try(form.close()) catch()
local sfIdx, clock
fn defColor r g b = ((dotNetClass "System.Drawing.Color").FromArgb r g b)		
fn defPoint x y = (dotNetObject "System.Drawing.Point" x y)	
fn defSize x y = (dotNetObject "System.Drawing.Size" x y)
 
Clr = defColor 0 0 0 ; ClrBG = defColor 60 60 60 ; ClrFG = defColor 200 200 200
 
fn defBtn dnBtn w h locX locY txt =
(
	dnBtn.Size = defSize w h ; dnBtn.Location = defPoint locX locY ; dnBtn.Text = txt 
	dnBtn.BackColor = ClrBG ; dnBtn.ForeColor = ClrFG ; dnBtn.FlatStyle = dnBtn.FlatStyle.Flat
	dnBtn.Appearance = dnBtn.Appearance.Button 
	dnBtn.FlatAppearance.CheckedBackColor = dnBtn.FlatAppearance.MouseDownBackColor = Clr
)
fn defForm dnForm w h x y =
(
	dnForm.ShowInTaskbar = false ; dnForm.Text = "ExampleForm" ; dnForm.ClientSize = defSize w h
	dnForm.StartPosition = dnForm.StartPosition.Manual ; dnForm.DesktopLocation = defPoint x y
	dnForm.FormBorderStyle = dnForm.FormBorderStyle.FixedSingle
	dnForm.MaximizeBox = dnForm.MinimizeBox = off
)

form = dotnetobject "MaxCustomControls.Maxform" ; defForm form 160 40 10 110
pickBtn = dotnetobject "CheckBox" ; defBtn pickBtn 150 30 5 5 "PickObject"
 
fn filterObj o = isKindOf o GeometryClass and canconvertto o Editable_Mesh  -- filter function for picking only real geo objects
fn go_attachall s obj =
(
	if s.checked == off do
	(
		if (obj = pickObject filter:filterObj obj) != undefined then
		(
			print (s.checked = off ; s.text = obj.name)
		) 
		else (s.checked = off ; s.text = "PickObject")
	)
)
dotnet.addEventHandler pickBtn "MouseDown" go_attachall
form.Controls.Add pickBtn
form.showmodeless() ; ok
)

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.