Editor Development - .NET 1.1 and shortcuts

Posted on:April 29 2006

Yesterday I finally made the exam which I did not risk to take for the last 3 years. Hope I managed to get a positive mark. So time for developing the editor a bit further, and I just stumbled about a small .NET problem with shortcuts. If you are using shortcuts in your applications, but also text boxes, you may run into a problem. Just like here:
As you can see, I'm using some of the general shortcuts like Ctrl+C, Ctrl+V and Delete. These shortcuts are used in textboxes too, to copy, paste and delete text. So, if you are editing a text box below in the property window and pressing 'delete', what do you think would happen? Would the text box delete a character or would the 'delete' shortcut be invoked, deleting the whole object? Sure, you would expect the character to be deleted. But not in .NET. Here, the shortcut comes first. There are ways to work around this problem, and they improved the workaround in .NET 2, but it's not nice. Or maybe I've overseen something.
I am thinking about stopping this project in .NET anyway, maybe this is a good time to do this. Writing applications in .NET has several advantages and I really like it, but it is quite horrible when you are wrapping a library written in native C++ (exteme slow debugging, random crashes while debugging, ugly gc() artifacts, ...). Also, the editor wouldn't be cross platform in this way anyway, Mono is still not supporting managed C++.
Someone knows a good cross platform UI library for C++? With docking windows? And not with QT in the name? ;) Thought about wxWidgets, but I'm not sure yet.


mmm, looks nice. dont know about nice gui with docking windows though.
2006-04-29 13:20:00

wxwidgets is nice. i have only used it with python though...
stan silvercan
2006-04-29 13:43:00

Hi Niko!

Don't know what kind of workarounds you mean, but here is our workaround...

WARNING - this code is taken from our upcoming EXCELSIOR Toolset and is incomplete... - needs to be completed to work in your Application - just one example to put you in the right direction ;-) - Hope it helps...

private void menuButtonItemCut_Activate(object sender, EventArgs e)
System.Windows.Forms.Control focusedControl = this.GetFocusedControl();
if (focusedControl is System.Windows.Forms.TextBoxBase)
else if (focusedControl is Lyquidity.Controls.ExtendedListViews.TreeListView)
// TODO: Special application processing for i.e. TreeListViews (expand this if needed!)
Excelsior.Toolset.Misc.Win32API_NativeMethods.SendMessage(new System.Runtime.InteropServices.HandleRef(this, Excelsior.Toolset.Misc.Win32API_NativeMethods.GetFocus()), (int)Excelsior.Toolset.Misc.Win32API_NativeMethods.Win32API_WM.WM_CUT, 0, 0);

private System.Windows.Forms.Control GetFocusedControl()
// Try and find the .net control instance with the focus
System.IntPtr focus = Excelsior.Toolset.Misc.Win32API_NativeMethods.GetFocus();
if (focus == System.IntPtr.Zero)
return null;
return System.Windows.Forms.Control.FromHandle(focus);

and make the P/Invoke things available (i.e. in an separate class as in the example above -> Win32API_NativeMethods, and don't forget to define things like WM_CUT)...

[System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto,
ExactSpelling = true, CallingConvention = System.Runtime.InteropServices.CallingConvention.Winapi)]
public static extern IntPtr GetFocus();

[System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto,
ExactSpelling = true, CallingConvention = System.Runtime.InteropServices.CallingConvention.Winapi)]
public static extern IntPtr SendMessage(System.Runtime.InteropServices.HandleRef hWnd, int msg, int wParam, int lParam);
Duncan Mac Leod
2006-04-29 13:54:00

Yeah, drop .net in the editor (and irrlicht). .Net is causing you hassles and most people use native c++ anyway, don't know why you chase .net so much and add features for it because come vista it will all need reworking again. Please think of x-platform, non framework needing native C++ primarily the rest is just smoke and mirrors. Keep up the good work , editor looks great ! :)
2006-04-29 14:10:00

Was it a math exam or theoretical computer sciene? Postponing for three years cannot be another topic, can it?
wxWindows seems to be quite useful and mature. Yozer, I hope you don't think of X11, no one would really want to program native X11!
2006-04-29 17:18:00

Go for wxWidgets, Niko, I can fully recommend it. You should check the Irrlicht integration first, though. It has a wxGLCanvas I render to in our DVW mission editor, but this might not be sufficient for Irrlichts hybrid approach.
One disadvantage is that there's no free, good WYSIWYG GUI editor, AFAIK, and coding the whole stuff is a painful thing sometimes...
2006-04-29 18:10:00

I too reccomend wxWidgets. I think I saw something about a WYSIWYG GUI editor that is like combined with Dev-Cpp but IDK. I say go for it, and I'm sure niko the amazing can get it integrated with irrlicht nicely ;-)
2006-04-29 18:49:00

And another vote for wxWidgets. About the GUI editor: There's wxGlade. (http://wxglade.sourceforge.net/)
2006-04-30 00:35:00

My opinion is that .net issue is the faster way for creating of similar stuff. Of course when Irrlicht.NET wraps native c++ Irrliht classes, working with properties is easy.
Borland properties are something like IDE managed in their vcl library, but here are some restrictions for properties wrapping user types, so I leaved these features in my project.
Using of native C++ for this goal needs creating of property library or creating of specific inspector classes for displaying of data from native c++ 'get()' functions.
About GUI, maybe I'm wrong but can't you use extended Irrlicht GUI for this goal? For example similar issue is used in Torque Mission editor for their object inspector.
2006-04-30 17:04:00

shortcuts aren't that big a deal, if they dont act right, just don't use them. this is not a good reason to stop developing this in .NET
I'll say this, c++ is all fine and good i guess, but.NET is a much more friendly, usable platform. I hate trying to figure out how to get something to compile because I have all my includes in the wrong farking order...thats why I avoid c++ in favor of .NET now. that, and its so easy to include external libs, just link the dll, and boom. that's it. not annoing header files and all their mess and confusion. I think in fact, irrlicht might not be .NET enough, and apparently there is enough people who agree, that this has spawned the Irrlicht# project, to rewrite irrlicht in pure c#. so basically, please ignore yozer above! he does not speak for us all...
2006-05-01 07:48:00

Think more about droping the Editor in .NET! (it's seems realy nice)
2006-05-01 09:27:00

thanks for all the tips, helped a lot. See newest blog post :)
2006-05-01 21:45:00

Add comment:

Posted by:

Enter the missing letter in: "Internation?l"




Possible Codes

Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]