[Closed] DotNet Form on top of Maxscript rollout
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)
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.
Now I am sure the problem is the rollout got the focus, and the .net form goes behind 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.
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.
are you sure? there are some samples on this forum those can change your mind…
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.
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.