Jump to content
Sign in to follow this  
sandin

problem with animated child window

Recommended Posts

sandin

this is my script:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Gui = GUICreate("Form1", 350, 450)
$Button1 = GUICtrlCreateButton("Button1", 20, 30, 150, 40)
GUISetState(@SW_SHOW, $Gui)
$ChildGui = GuiCreate("pop up", 200, 300, 100, 80, -1, $WS_EX_MDICHILD, $Gui)
$button2 = GUICtrlCreateButton("close", 20, 150, 60, 40)
GUISetBkColor ( 0xFF0000)
GUISetState(@SW_HIDE, $ChildGui)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $Button1
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $ChildGui, "int", 1000, "long", 0x00040004)
            GUISetState(@SW_SHOW, $ChildGui)
        case $button2
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $ChildGui, "int", 1000, "long", 0x00050008)
            GUISetState(@SW_HIDE, $ChildGui)
    EndSwitch
WEnd

when u pop up a child window, and click "close" button in it, it'll lave it's lines. Why is that? can it be avoided?

Share this post


Link to post
Share on other sites
FaT3oYCG

i dont understand your problem i run the script here are some screenshots of what i see

click the button

Posted Image

close the child

Posted Image

after the child has closed

Posted Image

i used the same code as you please explain in more detail what you want help with


Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites
ResNullius

when u pop up a child window, and click "close" button in it, it'll lave it's lines. Why is that? can it be avoided?

Try adding $WS_EX_LAYERED style to your parent GUI. And it might not hurt to throw in $WS_CLIPCHILDREN too.

$Gui = GUICreate("Form1", 350, 450,-1,-1,$WS_CLIPCHILDREN,$WS_EX_LAYERED)

Share this post


Link to post
Share on other sites
sandin

i dont understand your problem i run the script here are some screenshots of what i see

i used the same code as you please explain in more detail what you want help with

there's a visual bug while child window is going up like this:

Posted Image

it leaves it's trace as it's going up and I want to get rid of it

Look here to get idea about possiible solution :-)

http://www.autoitscript.com/forum/index.ph...st&p=354277

Ty for the link, so it seems that the pop up/down function should not be related to the "while" part, or.. I'm missing something? =( sry, but I'm not so much of an advanced autoit user, I still find that script confusing. =)

Try adding $WS_EX_LAYERED style to your parent GUI. And it might not hurt to throw in $WS_CLIPCHILDREN too.

$Gui = GUICreate("Form1", 350, 450,-1,-1,$WS_CLIPCHILDREN,$WS_EX_LAYERED)
I tried, it's still the same. =(

Share this post


Link to post
Share on other sites
FaT3oYCG

fair enuf i dont know why it does that take a look at the styles in the autoit help file or code the closing yourself e.g. make the height less and less every while loop and when it eventually gets small enuf kill the window or delete it with the gui delete function.


Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites
sandin

fair enuf i dont know why it does that take a look at the styles in the autoit help file or code the closing yourself e.g. make the height less and less every while loop and when it eventually gets small enuf kill the window or delete it with the gui delete function.

I already made that with winmove(), and locking child's controls locked by bottom line of the window, but I disliked it, cuz sliding is not smooth like using "user32.dll" animate window function.

Share this post


Link to post
Share on other sites
sandin

problem solved

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Gui = GUICreate("Form1", 350, 450)
$Button1 = GUICtrlCreateButton("Button1", 20, 30, 150, 40)
GUISetState(@SW_SHOW, $Gui)
$ChildGui = GuiCreate("pop up", 200, 300, 100, 80, -1, $WS_EX_MDICHILD, $Gui)
$button2 = GUICtrlCreateButton("close", 20, 150, 60, 40)
GUISetBkColor ( 0xFF0000)
GUISetState(@SW_HIDE, $ChildGui)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $Button1
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $ChildGui, "int", 1000, "long", 0x00040004)
            GUISetState(@SW_SHOW, $ChildGui)
        case $button2
            WinSetTrans($Gui, "", 254)
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $ChildGui, "int", 1000, "long", 0x00050008)
            GUISetState(@SW_HIDE, $ChildGui)
            WinSetTrans($Gui, "", 255)
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
elpresident3

Sorry to break this to you but try moving the parent window. The problem reappears.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×