PDA

View Full Version : XtraTreeList freeze when tab key is pressed in editor.


Sigmao
10-20-2009, 01:54 PM
Hi guys, i'm running into a really annoying problem with the DevExpress XtraTreeList.
When the user press tab while on the editor, it freeze max.

I've tried changing the OptionsBehavior.UseTabKey with no success.
I've also tried overwriting the EditorKeyDown event but max freeze before it trigger.

Any ideas?

Here an code example to reproduce the bug:

Try DestroyDialog TestCrashRollout Catch OK

Rollout TestCrashRollout "" Width:500 Height:316
(
DotNetControl dnc "DevExpress.XtraTreeList.TreeList" pos:[0,28] width:500 height:288
on TestCrashRollout open do
(
(dnc.Columns.Add()).visible = true
dnc.AppendNode #("First Line") -1
dnc.AppendNode #("Second Line") -1
)
)

CreateDialog TestCrashRollout

PEN
10-20-2009, 11:59 PM
Not sure what the problem is but I didn't have much luck at all with this control. I ran into all sorts of things that were a pain to setup or just didn't work right via Max script.

What is it you are trying to do?

denisT
10-21-2009, 12:59 AM
Hi guys, i'm running into a really annoying problem with the DevExpress XtraTreeList.
When the user press tab while on the editor, it freeze max.

I've tried changing the OptionsBehavior.UseTabKey with no success.
I've also tried overwriting the EditorKeyDown event but max freeze before it trigger.

Any ideas?

Here an code example to reproduce the bug:

Try DestroyDialog TestCrashRollout Catch OK

Rollout TestCrashRollout "" Width:500 Height:316
(
DotNetControl dnc "DevExpress.XtraTreeList.TreeList" pos:[0,28] width:500 height:288
on TestCrashRollout open do
(
(dnc.Columns.Add()).visible = true
dnc.AppendNode #("First Line") -1
dnc.AppendNode #("Second Line") -1
)
)

CreateDialog TestCrashRollout

yes. DevExpress controls don't like max Dialog and max Rollout Floater. There are some nasty bugs that I sow. But if you add the controls to MaxForm they work ok.


tv = dotNetObject "DevExpress.XtraTreeList.TreeList"
tv.dock = tv.dock.fill
(tv.Columns.Add()).visible = on
tv.AppendNode #("First Line") -1
tv.AppendNode #("Second Line") -1
fw = dotNetObject "MaxCustomControls.MaxForm"
fw.size = dotNetObject "System.Drawing.Size" 300 200
fw.controls.add tv
fw.showmodeless()

Sigmao
10-21-2009, 01:42 AM
yes. DevExpress controls don't like max Dialog and max Rollout Floater. There are some nasty bugs that I sow. But if you add the controls to MaxForm they work ok.
Thanks a lot Denis, it's working perfectly!
I never think about using MaxForm. :lightbulb

I ran into all sorts of things that were a pain to setup or just didn't work right via Max script.
Yeah XtraTreeList is tricky. At least the documentation is well done and the results are stunning.

denisT
10-21-2009, 01:54 AM
Thanks a lot Denis, it's working perfectly!
I never think about using MaxForm. :lightbulb


Yeah XtraTreeList is tricky. At least the documentation is well done and the results are stunning.

XtraTreeList works too slow for me, and very buggy. But anyway I use it in some cases...

PEN
10-21-2009, 12:12 PM
I managed to build my own by connecting up a treeview and other controls that I needed. Got me around any issues, caused a couple more but I was able to work around or correct them. Took a pile of code to do it how ever.

biddle
10-21-2009, 11:28 PM
There is something particular about how MXS deals with the GetNextDlgTabItem call. Unless things are configured 'just right' you can end up in an infinite loop.

From the looks of it, all MXS controls have WS_TABSTOP set so there is never any risk of a GetNextDlgTabItem call failing to return.

Of course the DevExpress controls don't have WS_TABSTOP set, but I found I could keep MXS from hanging if I set the WS_EX_CONTROLPARENTS style flag.

(For background on this known windows issue you can check out http://blogs.msdn.com/oldnewthing/archive/2004/07/30/201988.aspx)

My apologies if I'm coming across like a DevExpress fanboy, but this fix may come in handy when using other non-conforming .NET controls in rollouts too.

As usual, most of this sample is embedded C# code to avoid having to add an mxs extension dll. I couldn't find the SetWindowLong/GetWindowLong calls I needed in the default installation.

This code has NOT been tested in 64bit Max.

.biddle

--------------------------------------------------------------------------------------------------------------------
-- Expose the SetWindowLong and GetWindowLong functions from User32.dll
--------------------------------------------------------------------------------------------------------------------
fn CreateUser32Assembly forceRecompile:false =
(
if (forceRecompile or
(classof ::User32Assembly) != dotNetObject or
((::User32Assembly.GetType()).ToString()) != "System.Reflection.Assembly") do
(
sb = "using System;\n"
sb += "using System.Runtime.InteropServices;\n"
sb += "class User32\n"
sb += "{\n"
sb += " [DllImport(\"User32.DLL\", EntryPoint=\"GetWindowLong\")]\n"
sb += " public static extern Int32 GetWindowLong(IntPtr hWnd, Int32 index);\n"
sb += " [DllImport(\"User32.DLL\", EntryPoint=\"SetWindowLong\")]\n"
sb += " public static extern Int32 SetWindowLong(IntPtr hWnd, Int32 index, Int32 newVal);\n"
sb += "}\n"

csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"

compilerParams.GenerateInMemory = true
compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(sb)

if (compilerResults.Errors.Count > 0 ) then
(
errs = stringstream ""
for i = 0 to (compilerResults.Errors.Count-1) do
(
err = compilerResults.Errors.Item[i]
format "Error:% Line:% Column:% %\n" err.ErrorNumber err.Line \
err.Column err.ErrorText to:errs
)
MessageBox (errs as string) title: "Errors encountered while compiling C# code"
format "%\n" errs
::User32Assembly = undefined
return undefined
)
else
(
::User32Assembly = compilerResults.CompiledAssembly
)
)
::User32Assembly.CreateInstance "User32"
)

--------------------------------------------------------------------------------------------------------------------
-- Define a helper function that will set up the flags on a DevExpress control so tthat they
-- work properly with the MXS dialog message handler.
--------------------------------------------------------------------------------------------------------------------

fn SetWindowExStyle handle =
(

User32 = CreateUser32Assembly()

-- Make sure that the control and any containing controls are set as WS_EX_CONTROLPARENTS
GWL_EXSTYLE = -20
WS_EX_CONTROLPARENT = 0x00010000L

hwnd = dotnetobject "IntPtr" handle

curExStyle = User32.GetWindowLong hwnd GWL_EXSTYLE
curExStyle = User32.SetWindowLong hwnd GWL_EXSTYLE (bit.or curExStyle WS_EX_CONTROLPARENT)

kids = for k in (windows.getChildrenHWND handle) collect k[1]
for k in kids do
(
hwnd = dotnetobject "IntPtr" k
curExStyle = User32.GetWindowLong hwnd GWL_EXSTYLE
curExStyle = User32.SetWindowLong hwnd GWL_EXSTYLE (bit.or curExStyle WS_EX_CONTROLPARENT)
)
)

--------------------------------------------------------------------------------------------------------------------
-- Actual test code starts here. XtraTreeList hosted in a DotNetControl...
--------------------------------------------------------------------------------------------------------------------

Try DestroyDialog TestCrashRollout Catch OK

Rollout TestCrashRollout "" Width:500 Height:316
(
button foo "foo"
DotNetControl dnc "DevExpress.XtraTreeList.TreeList" width:480 height:140
checkbox bar "bar"

on TestCrashRollout open do
(
-- Make sure the extended style is correct
SetWindowExStyle dnc.handle

(dnc.Columns.Add()).visible = true
dnc.AppendNode #("First Line") -1
dnc.AppendNode #("Second Line") -1
)
)

CreateDialog TestCrashRollout

CGTalk Moderation
10-21-2009, 11:28 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.