Notifications
Clear all

[Closed] DotnetControl and DotnetObject differences

Hey guys, I was testing my custom Classes in a rollout and I’ve noticed that the treeview in a rollout acts different than in a windows forms.
For example:

...
dotNetControl tvFolders "KClasses.dnFolders" pos:[17,50] width:200 height:300
...
on tvFolders mouseDown sender eb do
(
	print eb
	showproperties eb
)

Returns:

dotNetObject:System.Windows.Forms.MouseEventArgs
  .Button : <System.Windows.Forms.MouseButtons>, read-only
  .Clicks : <System.Int32>, read-only
  .Delta : <System.Int32>, read-only
  .Location : <System.Drawing.Point>, read-only
  .X : <System.Int32>, read-only
  .Y : <System.Int32>, read-only
  .Empty : <System.EventArgs>, read-only, static

While when using this in a Windows Form:

...
tvFolders = dotnetobject "KClasses.dnFolders"
...
fn tvFolders_MouseDown sender eb =
(	
	print eb
	showproperties eb
)
dotnet.addEventHandler tvFolders "NodeMouseClick" tvFolders_MouseDown

Returns (correctly):

dotNetObject:System.Windows.Forms.TreeNodeMouseClickEventArgs
  .Button : <System.Windows.Forms.MouseButtons>, read-only
  .Clicks : <System.Int32>, read-only
  .Delta : <System.Int32>, read-only
  .Location : <System.Drawing.Point>, read-only
  .Node : <System.Windows.Forms.TreeNode>, read-only
  .X : <System.Int32>, read-only
  .Y : <System.Int32>, read-only
  .Empty : <System.EventArgs>, read-only, static

Any thoughts on this? I’ve tried searching but with no avail. Thanks in advance.

2 Replies

hey art!

is it not because you are showing the properties of the nodemouseclick versus the mousedown? i would think it’s returning correctly, mousedown is handled by a mouse event arg , nodemouseclick by a TreeNodeMouseClickEventArgs

in a rollout, you just call the correct event to show the output you were stating –


 rollout test "Untitled" width:212 height:311
 (
 	dotNetControl tvFolders "treeview" pos:[6,6] width:200 height:300
 	
 	on test open do
 	(
 		for i = 1 to 5 do
 		(
 		local t = dotnetobject "treenode" ("Node" +	i as string)		
 		tvfolders.nodes.add t
 		)
 			
 	)
 	on tvFolders NodeMouseClick sender eb do
 	(
 		print eb
 		showproperties eb
 	)
 )
 createdialog test 
dotNetObject:System.Windows.Forms.TreeNodeMouseClickEventArgs
  .Button : <System.Windows.Forms.MouseButtons>, read-only
  .Clicks : <System.Int32>, read-only
  .Delta : <System.Int32>, read-only
  .Location : <System.Drawing.Point>, read-only
  .Node : <System.Windows.Forms.TreeNode>, read-only
  .X : <System.Int32>, read-only
  .Y : <System.Int32>, read-only
  .Empty : <System.EventArgs>, read-only, static

Well… DUH! Thanks, I didn’t even noticed that! Don’t try to work, script, write emails, surf the web, listen to music at the same time and that should solve it Cheers and thanks.