Notifications
Clear all

[Closed] XtraTreeList getValue

biddle :buttrock:
asdotnetObject is THE KEY

Finally:

node = <treelistnode>
(dotnetclass “Convert”).toSingle(node.getValue 1 asdotnetObject:on)

DONE!!! I will sleep better now…

1 Reply
(@biddle)
Joined: 1 year ago

Posts: 0

BRILLIANT!

Serves me right for bitching about asdotnetObject not working for methods without actually testing it

Here it is –without any C#


try(destroyDialog testR)catch()

   rollout testR "Test" 
   (
   	dotNetControl xtl "DevExpress.xtraTreeList.treeList" height:200
 	   
	local converter = dotnetclass "Convert"
	   
   	fn initXtl xtl=
   	(		
		xtl.OptionsSelection.MultiSelect = True
   		xtl.OptionsView.ShowRoot =true
   		xtl.OptionsView.ShowIndicator = false
   		xtl.OptionsView.AutoWidth = true
   		
   		col=xtl.columns.add()
   		col.visible=true
   		col.width=120
   		col.caption="Items"
   		xtl.columns.item[0].fixed = xtl.columns.item[0].fixed.left
   		
   		local xTraSpinner=dotNetObject "DevExpress.XtraEditors.Repository.RepositoryItemSpinEdit"
   		xTraSpinner.SpinStyle=xTraSpinner.SpinStyle.vertical
   		xTraSpinner.minValue=0.0
   		xTraSpinner.maxValue=1.0
   		xTraSpinner.Increment=.1
   		xTraSpinner.UseCtrlIncrement=true
   		xTraSpinner.isFloatValue=true
   		xTraSpinner.AllowNullInput=xTraSpinner.AllowNullInput.false
   		xTraSpinner.nulltext="---  "
   		xtl.RepositoryItems.add xTraSpinner
   
   		col=xtl.columns.add()
   		col.visible=true
   		col.caption="Val:"
   		col.columnEdit=xTraSpinner
   		col.UnboundType=col.UnboundType.Decimal
   	)
   	
   	fn addTargetNamesToEtl xtl theNodes:#("Test1","Test2","Test3")=
   	(
   		xtl.ClearNodes()
   		for i = 1 to theNodes.count do
   		(
   			n0=xtl.appendNode #(theNodes[i],0.5) -1
   				pos=xtl.appendNode #("Sub 1:",0.0) n0
   				rot=xtl.appendNode #("Sub 2:",0.0) n0
   		)
   	)
   
   	on xtl SelectionChanged senderArg arg do
   	(
   --			  formatProps senderArg
   		for i = 0 to senderArg.selection.count-1 do
   		(
			valItm = senderArg.selection.item[i].getValue 1
			txtItm = senderArg.selection.item[i].GetDisplayText 1
			fltItm = converter.toSingle(senderArg.selection.item[i].getValue 1 asdotnetObject:on)
   			format "SelectionChanged: Index: % Value: % is a % Display Text: % Float Value: %
" i valItm (classof valItm) txtItm fltItm
   		)
   		
   	)
   
   	on xtl CellValueChanging senderArg arg do
   	(
		format "CellValueChangING: NodeId % Col % - " arg.node.id arg.column.AbsoluteIndex
		
		currVal = converter.toSingle(arg.node.Item arg.column.AbsoluteIndex asdotnetObject:on)
		newVal = converter.toSingle(arg.get_Value asdotnetObject:on)
		
		format "currval:% newval: %
" currVal newVal
   	)
   		
   	on xtl CellValueChanged senderArg arg do
   	(
		format "CellValueChangED: NodeId % Col % - " arg.node.id arg.column.AbsoluteIndex
		
		currVal = converter.toSingle(arg.node.Item arg.column.AbsoluteIndex asdotnetObject:on)
		newVal = converter.toSingle(arg.get_Value asdotnetObject:on)
		
		format "currval: % newval: %
" currVal newVal
   	)
   		
	on testR open do
   	(
   		initXtl xtl
   		addTargetNamesToEtl xtl
   	)
   )
   createDialog testR width:300 height:220

EDIT: in my excitement, I submitted the wrong version

 PEN

Hey Denis, looks like this still suffers from the problem of not updating when the spinner is changing.

Nice find though.

1 Reply
(@denist)
Joined: 1 year ago

Posts: 0

it does update on changing … use


on xtl CellValueChanging senderArg arg do
(
  format "changing: %
" ((dotnetclass "Convert").toSingle(getproperty arg #value asdotnetObject:on))
)


 PEN

Never mind, you are a brilliant!

((dotNetClass "convert").toSingle (getProperty arg #value asDotNetObject:true))

If I used the .node.getValue methed it will not return the changing value. But using the getProperty method it will.

WTF!

1 Reply
(@biddle)
Joined: 1 year ago

Posts: 0

FWIW,

You can access the getters and setters of a .NET object properties through methods.

v = foo.xxx

can also be expressed as

v = foo.get_xxx()

…all you needed was the underscore.

 PEN

Do you all have the feeling that we just went from A to B via Z??

 PEN

And just confirmed this works in the modifier panel as well.

Whoohoo!

Thank you every one.

oops… you are found it already…

But my problem is …
I can’t use XtraTreeList in my cases. IT’S VERY slow in comparison with list view and tree view…
My 1000 items kill XtraTreeList easy…
(and sometime I have 10000 items)

2 Replies
(@biddle)
Joined: 1 year ago

Posts: 0

Ok, so here is where we go for extra credit – my gut tells me it shouldn’t be stupid slow (unless it’s MXS getting to snoop all the events)

Have you considered setting up your treelist using a data source in “bound mode” see docs

Do you have a slow sample you can share?

(@denist)
Joined: 1 year ago

Posts: 0

i would make a sample as soon as i have a time… Thank you

 PEN

I haven’t tried lots of nodes in XtraTreeList yet and this project will not require it. I have done it with treeView and found that to be slow to populate the tree. I tested all my code and the slow down was only when treeView was being generated with the data. I would love to see how you work with bound data.

 PEN

Ok I’m back in hell again. Now I can’t get the spinner to work the way that I like because I can’t add event handlers for it in the modifier panel. I’m just not winning. I might be back to overlaying a spinner again.

So can any one tell me if there is a magic work around for this? One of those funky c# widgets maybe?

I want to be able to click and drag on a spinner as you can in Max. I just can’t track the mouse moving over the xtraTreeList as soon as the spinner is active.

1 Reply
(@denist)
Joined: 1 year ago

Posts: 0

here is a solution:


local spPressed = off
 fn spMouseDown s e =
 (
  format "down: % %
" [e.location.x,e.location.y] (e.Button == e.Button.Left)
  spPressed = on
 )
 fn spMouseMove s e = if spPressed do
 (
  format "move: % %
" [e.location.x,e.location.y] (e.Button == e.Button.Left)
 )
 fn spMouseUp s e = 
 (
  format "up: % %
" [e.location.x,e.location.y] (e.Button == e.Button.Left)
  spPressed = off
 )

 
xtSpinner = dotnetobject "DevExpress.XtraEditors.Repository.RepositoryItemSpinEdit"
dotnet.addeventhandler xtSpinner "MouseUp" spMouseUp 
dotnet.addeventhandler xtSpinner "MouseMove" spMouseMove 
dotnet.addeventhandler xtSpinner "MouseDown" spMouseDown 
 

on mouseDown you have to check what and where mouse button was pressed. If it fits your condition allow changing on drag. Calculate shift on move event. Stop on moseUp. Check RightClick for cancel.

 PEN

The problem is I can’t add the event handlers in the modifier panel. Try it with a scripted modifier and you will see that they just don’t take.

1 Reply
(@denist)
Joined: 1 year ago

Posts: 0

Any event handler added to dotnet control with dotnet.addeventhandler method doesn’t work in modifier panel. It seems like I tried everything to make it working. No success.

Page 3 / 3