View Full Version : DotNet Form on top of Maxscript rollout
heavenlypictures 07-05-2012, 07:53 PM Hi everybody!
I made a small timeline script, and I docked the maxscript rollout at the bottom, below the original timeline. The rollout has only two spinners. The other controls are in a .Net form. I placed the .Net form on top of the rollout without titlebar, without borders, using max's background color. So it looks like the part of the rollout. :)
But sometimes when I set the value of the spinners, the .Net form disappers. Or when I click on another .net script. But not everytime, just randomly.
It's not a solution to set the topmost property to true, because if I switch to another software, it still displayed. I tried to call the focus method when it loses the focus, but its not good to always focus on it, because I can' use the rollout spinners and anything else.
I don't know what to do. Is anybody have a good idea?
(I use the .Net form modeless)
Thanks
|
|
Is that what you are after?
--Set the parent of the form to be Max.
--Get the max handle pointer.
maxHandlePointer=(Windows.GetMAXHWND())
--Convert the HWND handle of Max to a dotNet system pointer
sysPointer = DotNetObject "System.IntPtr" maxHandlePointer
--Create a dotNet wrapper containing the maxHWND
maxHwnd = DotNetObject "MaxCustomControls.Win32HandleWrapper" sysPointer
--Show the Max form using the wrapper.
form.Show (maxHwnd)
heavenlypictures
07-05-2012, 08:23 PM
Yes, I use it in this way. I also tried the the form.showmodeless() way, but nothing changed.
Maybe the docked rollout got the focus, and the .net form diappears. But if I click the middle of the rollout, the .net form appears again. I don't know what is the problem.
If I use the BringToFront() method it appears again, but need an event when to use it.
I tried the lostfocus() event, but it loose its focus only one time, and after it lost it, never lost it again.
It should be good if the rollout has a gotfocus event, but it doesn't have. :(
heavenlypictures
07-05-2012, 09:01 PM
Now I am sure the problem is the rollout got the focus, and the .net form goes behind the rollout. :(
:(
denisT
07-05-2012, 11:21 PM
Hi everybody!
I made a small timeline script, and I docked the maxscript rollout at the bottom, below the original timeline. The rollout has only two spinners. The other controls are in a .Net form. I placed the .Net form on top of the rollout without titlebar, without borders, using max's background color. So it looks like the part of the rollout. :)
i'm sure that you overcomplicated the problem. however to get the thing works right you have to make the form a child of the rollout.
heavenlypictures
07-06-2012, 12:19 AM
You can't place dotNetForms in a maxscript rollout. You can only use dotNetControls in rollouts. In my script I want to use images as sliders. So I placed dotNet Imageboxes as a child of the rollout, but the images are flashes (vibrate) when I grab them with the mouse. It was horrible. I tried to reduce the refresh rate, but nothing changed. After that I tried grabbing images in dotNetForms, and they are moved smoothly. So that's why I use dotNetObjects in dotNetForm placed on top of a rollout instead of dotNetControls in a rollout.
denisT
07-06-2012, 12:33 AM
You can't place dotNetForms in a maxscript rollout. You can only use dotNetControls in rollouts.
are you sure? there are some samples on this forum those can change your mind...
heavenlypictures
07-06-2012, 12:43 AM
Yes, I'm sure. You can place dotNet Objects, Controls, and Classes as a child of a maxscript rollout. But not complete dotNetForms.
Max can't refresh smoothly dotnet objects and controls in a rollout, so i have to place controls and object into a dotNetForm. The dotNetForm appears in a standard window, so i can't dock it to the bottom.
I didn't find any example. But if you can send me link where somebody place a complete dotNetForm with dotNetObjects into a maxscript rollout, i will check it.
Thank you
denisT
07-06-2012, 01:13 AM
Yes, I'm sure. You can place dotNet Objects, Controls, and Classes as a child of a maxscript rollout. But not complete dotNetForms.
Max can't refresh smoothly dotnet objects and controls in a rollout, so i have to place controls and object into a dotNetForm. The dotNetForm appears in a standard window, so i can't dock it to the bottom.
I didn't find any example. But if you can send me link where somebody place a complete dotNetForm with dotNetObjects into a maxscript rollout, i will check it.
Thank you
the easiest way for you to get an advice is to post a sample of your code and show the problem... now i see two:
# flickering of .net controls in max rollout
# making .net form ownered by max rollout
and they are not interdependent...
I use dotNet in Max Script rollouts all the time and it works just fine. Don't know where you get that it doesn't refresh correctly.
heavenlypictures
07-06-2012, 08:36 AM
Here are two scripts:
http://www.heavenlypictures.hu/dotnet_maxscript.zip
1: dotnet object in maxscript rollout
2: dotnet object in dotnet form
Just try them. Drag the image, and you will see that dotnet object in maxscript rollout is flickering.
That's why I place my images into a dotnet form, and place my form without titlebar and borders on top of the maxscript rollout.
And the problem is: when the rollout got focus, the dotnetform goes behind the rollout.
And another thing: maxscript rollout doesn't support png images with alpha channel.
DotNet form does.
Have you tried placing a dotNetControl "ContainerControl" in a rollout and then place dotNetObjects in the container? That is how I usually do it when I need that sort of hybrid UI.
heavenlypictures
07-06-2012, 01:17 PM
Yes, Yes, Yes!
It works! I placed a ContainerControl into the rollout, and place the objects into the container, and the images are not flickering when grab them.
Thank you Paul. You saved my life.
heavenlypictures
07-10-2012, 12:42 PM
Hi Paul!
I have another problem, I hope you can help me.
Now the dotnet objects don't go behind the rollout. But when Max refreshes its user interface (open material editor, toggle ribbon toolbar, switch to modify panel, ...) my dotnet objects disappear. But this happenes only when the toolbar docked.
Please download the script, run it, and open the material editor. You will see the dotnet object disappear. After that undock the dialogbar, and open the material editor again. You will see the dotnet object doesn't disappear. So everytime when max refresh the user inerface, dotnet objects disappear in docked dialogbar. What's wrong with it? What can I do? Please help me!
http://www.heavenlypictures.hu/dotnet_disappear.zip
Krisztián
gazybara
07-10-2012, 01:03 PM
I don't know is this wath you looking for
http://apps.jhaywood.com/Blog/?e=51000&d=06/30/2010&s=WPF%20Refresh%20Issue%20With%20Docked%20Rollouts
heavenlypictures
07-10-2012, 01:15 PM
Yes, that's it. Thank you very much. It works.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.