Jump to content
DigDeep

Lable Flip instead of Show / Hide

Recommended Posts

DigDeep

Hi there,

I have this working fine. Basically clicking on the Button1 (Flip) button will hide the Label1, Label2 and Button1 and show the Label3, Label4 and Button2. The reverse will happen if Button2 (Back) is clicked.

Is there a way, instead of hiding the Labels and Buttons can I get them to flip Right to Left as pages do?

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

Global $Button1, $Button2 = 9999

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 215, 387, 599, 173)
GUISetBkColor(0xFFFFFF)
$Label1 = GUICtrlCreateLabel("", 8, 16, 196, 324, $SS_CENTER)
GUICtrlSetBkColor(-1, 0xFF8000)
$Label2 = GUICtrlCreateLabel("1", 14, 152, 184, 30, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xFF8000)
$Button1 = GUICtrlCreateButton("Flip", 8, 352, 195, 25, BitOR($SS_CENTER, $BS_DEFPUSHBUTTON))
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)

$Label3 = GUICtrlCreateLabel("", 8, 16, 196, 324, $SS_CENTER)
GUICtrlSetBkColor(-1, 0xFF8000)
GUICtrlSetState(-1, $GUI_HIDE)
$Label4 = GUICtrlCreateLabel("2", 14, 152, 184, 30, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xFF8000)
GUICtrlSetState(-1, $GUI_HIDE)
$Button2 = GUICtrlCreateButton("Back", 8, 352, 195, 25, BitOR($SS_CENTER, $BS_DEFPUSHBUTTON))
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetState($Button2, $GUI_HIDE)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            GUICtrlSetState($Label1, $GUI_HIDE)
            GUICtrlSetState($Label2, $GUI_HIDE)
            GUICtrlSetState($Button1, $GUI_HIDE)

            GUICtrlSetState($Label3, $GUI_SHOW)
            GUICtrlSetState($Label4, $GUI_SHOW)
            GUICtrlSetState($Button2, $GUI_SHOW)



        Case $Button2
            GUICtrlSetState($Label3, $GUI_HIDE)
            GUICtrlSetState($Label4, $GUI_HIDE)
            GUICtrlSetState($Button2, $GUI_HIDE)

            GUICtrlSetState($Label1, $GUI_SHOW)
            GUICtrlSetState($Label2, $GUI_SHOW)
            GUICtrlSetState($Button1, $GUI_SHOW)
    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro

Hi @DigDeep:)
I think you cannot do this kind of "effect" in AutoIt.
Is that what you were trying to do, isn't it?

Best Regards.


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Andreik

Actually it might be done with GDI+. Take a screen shot of the region and then create the effect that you are looking for.


When the words fail... music speaks

Share this post


Link to post
Share on other sites
Chimp

.... as @Zednasuggested, using a simple loop ...

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

Global $Button1, $Button2
Global $iWin_Width = 215, $iSleep

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", $iWin_Width, 387, 599, 173)
GUISetBkColor(0xFFFFFF)
$Label1 = GUICtrlCreateLabel("", 8, 16, 196, 324, $SS_CENTER)
GUICtrlSetBkColor(-1, 0xFF8000)
$Label2 = GUICtrlCreateLabel("1", 8, 152, 186, 30, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xFF8000)
$Button1 = GUICtrlCreateButton("Flip", 8, 352, 195, 25, BitOR($SS_CENTER, $BS_DEFPUSHBUTTON))
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)

$Label3 = GUICtrlCreateLabel("", 8 + $iWin_Width, 16, 196, 324, $SS_CENTER)
GUICtrlSetBkColor(-1, 0xFF8000)
; GUICtrlSetState(-1, $GUI_HIDE)
$Label4 = GUICtrlCreateLabel("2", 8 + $iWin_Width, 152, 186, 30, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xFF8000)
; GUICtrlSetState(-1, $GUI_HIDE)
$Button2 = GUICtrlCreateButton("Back", 8 + $iWin_Width, 352, 195, 25, BitOR($SS_CENTER, $BS_DEFPUSHBUTTON))
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
; GUICtrlSetState($Button2, $GUI_HIDE)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Local $iStep = 8
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            $iSleep = 100
            For $ii = 0 To $iWin_Width + $iStep Step $iStep
                GUICtrlSetPos($Label1, (ControlGetPos("", "", $Label1)[0]) - $iStep)
                GUICtrlSetPos($Label2, (ControlGetPos("", "", $Label2)[0]) - $iStep)
                GUICtrlSetPos($Button1, (ControlGetPos("", "", $Button1)[0]) - $iStep)
                ;
                GUICtrlSetPos($Label3, (ControlGetPos("", "", $Label3)[0]) - $iStep)
                GUICtrlSetPos($Label4, (ControlGetPos("", "", $Label4)[0]) - $iStep)
                GUICtrlSetPos($Button2, (ControlGetPos("", "", $Button2)[0]) - $iStep)
                Sleep($iSleep)
                $iSleep /= 1.3
            Next

        Case $Button2
                $iSleep = 100
            For $ii = 0 To $iWin_Width + 8 Step 8
                GUICtrlSetPos($Label1, (ControlGetPos("", "", $Label1)[0]) + $iStep)
                GUICtrlSetPos($Label2, (ControlGetPos("", "", $Label2)[0]) + $iStep)
                GUICtrlSetPos($Button1, (ControlGetPos("", "", $Button1)[0]) + $iStep)
                ;
                GUICtrlSetPos($Label3, (ControlGetPos("", "", $Label3)[0]) + $iStep)
                GUICtrlSetPos($Label4, (ControlGetPos("", "", $Label4)[0]) + $iStep)
                GUICtrlSetPos($Button2, (ControlGetPos("", "", $Button2)[0]) + $iStep)
                Sleep($iSleep)
                $iSleep /= 1.3
            Next
    EndSwitch
WEnd

 


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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

×