Sign in to follow this  
Followers 0
anunes

GUI need help!

5 posts in this topic

Hi, I'm new and I've a problem with my simple program... It open a login window and gets the login and password of the user, and should close the login window and open the program window... but, I don't know how to do this...

I have the two GUIs, the login one and the program window one... what I want is: when the user type the login and passwod and clicks on OK, it's close the login form and open the program form...

How do I do this?

Thanks

Share this post


Link to post
Share on other sites



anunes,

There are many ways you could do this, but without seeing your code it is difficult to decide which would work best.

If you are using a While...WEnd loop to check for the GUIGetMsg() return value, then a GUIDelete for your LogIn GUI, followed by an ExitLoop to escape from the While...WEnd loop into the program GUI code seems a good ploy.

Post your code - you are likely to get a better answer!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

anunes,

There are many ways you could do this, but without seeing your code it is difficult to decide which would work best.

If you are using a While...WEnd loop to check for the GUIGetMsg() return value, then a GUIDelete for your LogIn GUI, followed by an ExitLoop to escape from the While...WEnd loop into the program GUI code seems a good ploy.

Post your code - you are likely to get a better answer!

M23

Thanks man, here's my login code:

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

#Region ### START Koda GUI section ### Form=
$formLogin = GUICreate("Login", 239, 132)
$bOK = GUICtrlCreateButton("&OK", 40, 88, 75, 25, 0)
$bCancelar = GUICtrlCreateButton("&Cancelar", 136, 88, 75, 25, 0)
$lUsuario = GUICtrlCreateLabel("Usuário", 48, 32, 40, 17)
$lSenha = GUICtrlCreateLabel("Senha", 53, 56, 35, 17)
$iUsuario = GUICtrlCreateInput("", 96, 30, 121, 21)
$iSenha = GUICtrlCreateInput("", 96, 54, 121, 21, $ES_PASSWORD)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $user
Global $passwd

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $bCancelar
            MsgBox(0, "Obrigado", "Obrigado por testar o progama!")
            Exit
        Case $bOK
            $user = GUICtrlRead($iUsuario)
            $passwd = GUICtrlRead($iSenha)
            If $user = "" Or $passwd = "" Then
                MsgBox(16, "Erro", "Você precisa digitar usuário e senha")
            Else
                ExitLoop
            EndIf
    EndSwitch
WEndoÝ÷ Ø    ÝêÞßÛ-çè®jì0whÁ«­¢+Ø¥¹±Õ±Ðí    ÕÑѽ¹
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíU%
½¹ÍѹÑÍà¹ÔÌÐì(¥¹±Õ±Ðí]¥¹½ÝÍ
½¹ÍѹÑ̹ÔÌÐì((I¥½¸MQIP-½U$ÍÑ¥½¸½É´ô(ÀÌØí½ÉµAɽɵôU%
ÉÑ ÅÕ½Ðí9½Ù¼AɽɵÅÕ½Ðì°ÌÐÔ°ÄàÔ°ÄäÌ°ÄÈÔ¤(ÀÌØíÉ¥ÈôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐìµÀíÉ¥ÈÅÕ½Ðì°ÈаÄØ°ÜÔ°ÈÔ°À¤(ÀÌØí9½Ù¼ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐìµÀí9½Ù¼ÅÕ½Ðì°ÈÐà°ÄØ°ÜÔ°ÈÔ°À¤(ÀÌØíM±ÙÈôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐìµÀíM±ÙÈÅÕ½Ðì°ÈаÄÈà°ÜÔ°ÈÔ°À¤(ÀÌØíM¥ÈôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíM¤µÀíÈÅÕ½Ðì°ÈÐà°ÄÈà°ÜÔ°ÈÔ°À¤)U%MÑMÑÑ¡M]}M!=¤(¹I¥½¸9-½U$ÍÑ¥½¸()]¡¥±Ä($ÀÌØí¹5ÍôU%Ñ5Í ¤(%MÝ¥Ñ ÀÌØí¹5Í($%
ÍÀÌØíU%}Y9Q}
1=M($$%á¥Ð()¹MÝ¥Ñ )]¹

How, when the login form closes, do I do to this window open?

Edited by anunes

Share this post


Link to post
Share on other sites

anunes,

Just as I suggested earlier, change your Case $bOK to read:

Case $bOK
          $user = GUICtrlRead($iUsuario)
            $passwd = GUICtrlRead($iSenha)
            If $user = "" Or $passwd = "" Then
                MsgBox(16, "Erro", "Você precisa digitar usuário e senha")
            Else
                GUIDelete($formLogin)
                ExitLoop
            EndIf

Then you just add your second script to the end of the first one (there is no need to copy the includes).

In case you are interested, there is a thread here which has a good login script if you would like some hints as to how deal with usernames/password pairs.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

anunes,

Just as I suggested earlier, change your Case $bOK to read:

Case $bOK
          $user = GUICtrlRead($iUsuario)
            $passwd = GUICtrlRead($iSenha)
            If $user = "" Or $passwd = "" Then
                MsgBox(16, "Erro", "Você precisa digitar usuário e senha")
            Else
                GUIDelete($formLogin)
                ExitLoop
            EndIf

Then you just add your second script to the end of the first one (there is no need to copy the includes).

In case you are interested, there is a thread here which has a good login script if you would like some hints as to how deal with usernames/password pairs.

M23

Hey M23, thank you very much, it's working fine now!

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  
Followers 0