Sign in to follow this  
Followers 0
Marius

Problems with child window!

5 posts in this topic

#1 ·  Posted (edited)

Seems, that I'm stuck. I can't use another While on child. Is there any way to use GuiGetMsg on child window?

Here's programm

;; Prijungti
#include <GUIConstants.au3>
#include <Date.au3>
#Include <GuiList.au3>
;; /Prijungti

;; Kintamieji
$ver = "0.5"
$firma = '"RipStar"'
$address = "http://www.ripstar.lt"
$mail ="ripstar@ripstar.lt"
$tel = "865141743"
$ftp = ""
$data = _NowCalcDate()
;; /Kintamieji


;;;;GUI
$1 = GUICreate("Usakovas v" & $ver & " by " & $firma & " (iandien yra: " & $data & ")", 600, 600)
GUISetState (@SW_SHOW)
GUISetFont(-1, -1, -1, "Arial")

$menu1 = GUICtrlCreateMenu ( "Programa", -1)
$exit = GUICtrlCreateMenuitem ( "Ieiti", $menu1)


$menu2 = GUICtrlCreateMenu ( "Pagalba", -1)
$about = GUICtrlCreateMenuitem ( "Apie", $menu2)


$back = GUICtrlCreatePic ("newmark1.bmp", 0, 0, 600, 600)
GuiCtrlSetState($back, $GUI_DISABLE)

;; User info
GUICtrlCreateGroup("Kontaktinė informacija:", 60, 60, 480, 215)
$z1 = GUICtrlCreateLabel("Vardas:", 80, 90, 70, 25)
$vardas = GUICtrlCreateInput("", 160, 90, 200, 20, $ES_AUTOHSCROLL + $ES_UPPERCASE)
GUICtrlSetFont($z1, 12 , -1, 2, "Arial")
GUICtrlSetColor($z1, 0xFFFFFF)
GUICtrlSetBkColor($z1, -1)
$z2 = GUICtrlCreateLabel("Pavardė:", 80, 125, 70, 25)
$pavarde = GUICtrlCreateInput("", 160, 125, 200, 20, $ES_AUTOHSCROLL + $ES_UPPERCASE)
GUICtrlSetFont($z2, 12 , -1, 2, "Arial")
GUICtrlSetColor($z2, 0xFFFFFF)
GUICtrlSetBkColor($z2, -1)
$z3 = GUICtrlCreateLabel("Telefonas:", 80, 160, 70, 25)
$telefonas = GUICtrlCreateInput("", 160, 160, 200, 20, $ES_AUTOHSCROLL + $ES_NUMBER)
GUICtrlSetFont($z3, 12 , -1, 2, "Arial")
GUICtrlSetColor($z3, 0xFFFFFF)
GUICtrlSetBkColor($z3, -1)
$z4 = GUICtrlCreateLabel("Apskritis:", 80, 195, 70, 25)
$miestas = GUICtrlCreateCombo ("", 160, 195, 200, 20)
GUICtrlSetData(-1,"Alytus|Anykčiai|Birai|Druskininkai|Ignalina|Jurbarkas|Jonikis|Kelmė|Klaipėda|Kretinga|Kupikis|Lazdijai|Marijampolė|Maeikiai|Molėtai|Naujoji Akmenė|Neringa|Pakruojis|Palanga|Panevėys|Pasvalys|Plungė|Radvilikis|Rokikis|Skuodas|akiai|alčininkai|iauliai|ilalė|ilutė|irvintos|venčionys|Tauragė|Teliai|Trakai|Ukmergė|Utena|Varėna|Vilkavikis|Vilnius|Visaginas|Zarasai")
GUICtrlSetFont($z4, 12 , -1, 2, "Arial")
GUICtrlSetColor($z4, 0xFFFFFF)
GUICtrlSetBkColor($z4, -1)
$z5 = GUICtrlCreateLabel("Adresas:", 80, 230, 70, 25)
$adresas = GUICtrlCreateInput("", 160, 230, 200, 20, $ES_AUTOHSCROLL + $ES_UPPERCASE)
GUICtrlSetFont($z5, 12 , -1, 2, "Arial")
GUICtrlSetColor($z5, 0xFFFFFF)
GUICtrlSetBkColor($z5, -1)
;; /User info

;; Usakymai
GUICtrlCreateGroup("Usakymai", 60, 290, 480, 215)
$sarasas = GUICtrlCreateList ( "", 190, 320, 325, 155, $LBS_STANDARD)
$new = GUICtrlCreateButton ("Naujas", 80, 320, 90, 50)
$delete = GUICtrlCreateButton ("Itrinti", 80, 380, 90, 25)

$l1 = GUICtrlCreateLabel("I viso usakyta", 190, 470, 100, 25)
$cd = GUICtrlCreateInput ( "0", 295, 470, 30, 20, $ES_READONLY + $ES_CENTER)
$l1a = GUICtrlCreateLabel("CD/DVD", 330, 470, 60, 25)
$l2 = GUICtrlCreateLabel("u", 390, 470, 20, 25)
$lt = GUICtrlCreateInput ( "0", 410, 470, 30, 20, $ES_READONLY + $ES_CENTER)
$l2a = GUICtrlCreateLabel("Lt", 445, 470, 20, 25)
$ct = GUICtrlCreateInput ( "00", 465, 470, 30, 20, $ES_READONLY + $ES_CENTER)
$l2b = GUICtrlCreateLabel("ct", 503, 470, 10, 25)

GUICtrlSetFont($l1, 11, -1, -1, "Arial")
GUICtrlSetColor($l1, 0xFFFFFF)
GUICtrlSetFont($l1a, 11, -1, -1, "Arial")
GUICtrlSetColor($l1a, 0xFFFFFF)
GUICtrlSetFont($l2, 11, -1, -1, "Arial")
GUICtrlSetColor($l2, 0xFFFFFF)
GUICtrlSetFont($l2a, 11, -1, -1, "Arial")
GUICtrlSetColor($l2a, 0xFFFFFF)
GUICtrlSetFont($l2b, 11, -1, -1, "Arial")
GUICtrlSetColor($l2b, 0xFFFFFF)

GUICtrlCreateGroup("", 80, 415, 90, 70)
$kl = GUICtrlCreatePic ("cd-recordable.jpg", 85, 427, 80, 53)
GUICtrlSetState($kl, $GUI_HIDE)
GUICtrlSetState($kl, $GUI_SHOW)
;;/Usakymai

$raktai = GUICtrlCreatePic ("wpakey.bmp", 395, 100, 110, 135)
GUICtrlSetState($raktai, $GUI_HIDE)
GUICtrlSetState($raktai, $GUI_SHOW)

GUICtrlCreateGroup("", 390, 90, 120, 150)
$label = GUICtrlCreateLabel("Sukurta Dirty_Bastard" & @CRLF & "              2005", 390, 20, 180, 50)
GUICtrlSetFont($label, 10, -1, -1, "Comic Sans MS")
GUICtrlSetColor($label, 0xFFFFFF)
GUICtrlCreateButton ("Isiųsti", 160, 530, 280, 25)
;;;;/GUI


;; Veiksmai
While 1
    $msg = GUIGetMsg()
    
    If $msg = $about Then
        MsgBox(32, "Apie", "Usakovas v" & $ver & @CRLF & @CRLF & "i programa padės usakyti norimą paslaugą i firmos " & $firma & "." & @CRLF & "(Detalesnė informacija adresu: " & $address & ")" & @CRLF & @CRLF & "Telefonas: " & $tel & @CRLF & "WWW: " & $address & @CRLF & "@mail: " & $mail)
    EndIf
    
    If $msg = $delete Then
        $sak = _GUICtrlListGetCaretIndex($sarasas)
        _GUICtrlListDeleteItem($sarasas, $sak)
    EndIf
    
    If $msg = $new Then
        $child = GUICreate("Pridėti naują usakymą", 300, 300, -1, -1, $WS_BORDER, -1, $1)
        $back2 = GUICtrlCreatePic ("newmark1.bmp", 0, 0, 300, 300)
        GuiCtrlSetState($back2, $GUI_DISABLE)
        GUISetState (@SW_SHOW)
        $end = GUICtrlCreateButton ("Baigti", 10,10 ,100, 25)
        













    ;; Button doesn't work!!!
        If $msg = $end Then
            MsgBox(32, "aaa", "a")
        EndIf
    ;; /Button doesn't work!!!






    EndIf

    If $msg = $GUI_EVENT_CLOSE Or $msg = $exit Then ExitLoop
Wend
    
GUIDelete()    
Exit
;; /Veiksmai
Edited by Marius

Marius back in da hood! :)

Share this post


Link to post
Share on other sites



just use a different variable receiving the message

main loop your using $msg

for child window use something like $msg2


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

see "Advanced GUIGetMsg and Multiple Windows" in the Help file


[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites

Thanks :)


Marius back in da hood! :)

Share this post


Link to post
Share on other sites

Check the little changes.

NOTE: It's an alternative only.

SUGGESTION: Experiment with the examples provided in the helpfile/installation.

;; Prijungti
#include <GUIConstants.au3>
#include <Date.au3>
#Include <GuiList.au3>
;; /Prijungti

;; Kintamieji
$ver = "0.5"
$firma = '"RipStar"'
$address = "http://www.ripstar.lt"
$mail ="ripstar@ripstar.lt"
$tel = "865141743"
$ftp = ""
$data = _NowCalcDate()
;; /Kintamieji


;;;;GUI
$1 = GUICreate("Usakovas v" & $ver & " by " & $firma & " (iandien yra: " & $data & ")", 600, 600)
GUISetState (@SW_SHOW)
GUISetFont(-1, -1, -1, "Arial")

$menu1 = GUICtrlCreateMenu ( "Programa", -1)
$exit = GUICtrlCreateMenuitem ( "Ieiti", $menu1)


$menu2 = GUICtrlCreateMenu ( "Pagalba", -1)
$about = GUICtrlCreateMenuitem ( "Apie", $menu2)


$back = GUICtrlCreatePic ("newmark1.bmp", 0, 0, 600, 600)
GuiCtrlSetState($back, $GUI_DISABLE)

;; User info
GUICtrlCreateGroup("Kontaktine informacija:", 60, 60, 480, 215)
$z1 = GUICtrlCreateLabel("Vardas:", 80, 90, 70, 25)
$vardas = GUICtrlCreateInput("", 160, 90, 200, 20, $ES_AUTOHSCROLL + $ES_UPPERCASE)
GUICtrlSetFont($z1, 12 , -1, 2, "Arial")
GUICtrlSetColor($z1, 0xFFFFFF)
GUICtrlSetBkColor($z1, -1)
$z2 = GUICtrlCreateLabel("Pavarde:", 80, 125, 70, 25)
$pavarde = GUICtrlCreateInput("", 160, 125, 200, 20, $ES_AUTOHSCROLL + $ES_UPPERCASE)
GUICtrlSetFont($z2, 12 , -1, 2, "Arial")
GUICtrlSetColor($z2, 0xFFFFFF)
GUICtrlSetBkColor($z2, -1)
$z3 = GUICtrlCreateLabel("Telefonas:", 80, 160, 70, 25)
$telefonas = GUICtrlCreateInput("", 160, 160, 200, 20, $ES_AUTOHSCROLL + $ES_NUMBER)
GUICtrlSetFont($z3, 12 , -1, 2, "Arial")
GUICtrlSetColor($z3, 0xFFFFFF)
GUICtrlSetBkColor($z3, -1)
$z4 = GUICtrlCreateLabel("Apskritis:", 80, 195, 70, 25)
$miestas = GUICtrlCreateCombo ("", 160, 195, 200, 20)
GUICtrlSetData(-1,"Alytus|Anykciai|Birai|Druskininkai|Ignalina|Jurbarkas|Jonikis|Kelme|Klaipeda|Kretinga|Kupiki

s|Lazdijai|Marijampole|Maeikiai|Moletai|Naujoji Akmene|Neringa|Pakruojis|Palanga|Paneveys|Pasvalys|Plunge|Radvilikis|Rokikis|Skuodas|akiai|alci

ninkai|iauliai|ilale|ilute|irvintos|vencionys|Taurage|Teliai|Trakai|Ukmerge|Utena|Varena|Vilka

vikis|Vilnius|Visaginas|Zarasai")
GUICtrlSetFont($z4, 12 , -1, 2, "Arial")
GUICtrlSetColor($z4, 0xFFFFFF)
GUICtrlSetBkColor($z4, -1)
$z5 = GUICtrlCreateLabel("Adresas:", 80, 230, 70, 25)
$adresas = GUICtrlCreateInput("", 160, 230, 200, 20, $ES_AUTOHSCROLL + $ES_UPPERCASE)
GUICtrlSetFont($z5, 12 , -1, 2, "Arial")
GUICtrlSetColor($z5, 0xFFFFFF)
GUICtrlSetBkColor($z5, -1)
;; /User info

;; Usakymai
GUICtrlCreateGroup("Usakymai", 60, 290, 480, 215)
$sarasas = GUICtrlCreateList ( "", 190, 320, 325, 155, $LBS_STANDARD)
$new = GUICtrlCreateButton ("Naujas", 80, 320, 90, 50)
$delete = GUICtrlCreateButton ("Itrinti", 80, 380, 90, 25)

$l1 = GUICtrlCreateLabel("I viso usakyta", 190, 470, 100, 25)
$cd = GUICtrlCreateInput ( "0", 295, 470, 30, 20, $ES_READONLY + $ES_CENTER)
$l1a = GUICtrlCreateLabel("CD/DVD", 330, 470, 60, 25)
$l2 = GUICtrlCreateLabel("u", 390, 470, 20, 25)
$lt = GUICtrlCreateInput ( "0", 410, 470, 30, 20, $ES_READONLY + $ES_CENTER)
$l2a = GUICtrlCreateLabel("Lt", 445, 470, 20, 25)
$ct = GUICtrlCreateInput ( "00", 465, 470, 30, 20, $ES_READONLY + $ES_CENTER)
$l2b = GUICtrlCreateLabel("ct", 503, 470, 10, 25)

GUICtrlSetFont($l1, 11, -1, -1, "Arial")
GUICtrlSetColor($l1, 0xFFFFFF)
GUICtrlSetFont($l1a, 11, -1, -1, "Arial")
GUICtrlSetColor($l1a, 0xFFFFFF)
GUICtrlSetFont($l2, 11, -1, -1, "Arial")
GUICtrlSetColor($l2, 0xFFFFFF)
GUICtrlSetFont($l2a, 11, -1, -1, "Arial")
GUICtrlSetColor($l2a, 0xFFFFFF)
GUICtrlSetFont($l2b, 11, -1, -1, "Arial")
GUICtrlSetColor($l2b, 0xFFFFFF)

GUICtrlCreateGroup("", 80, 415, 90, 70)
$kl = GUICtrlCreatePic ("cd-recordable.jpg", 85, 427, 80, 53)
GUICtrlSetState($kl, $GUI_HIDE)
GUICtrlSetState($kl, $GUI_SHOW)
;;/Usakymai

$raktai = GUICtrlCreatePic ("wpakey.bmp", 395, 100, 110, 135)
GUICtrlSetState($raktai, $GUI_HIDE)
GUICtrlSetState($raktai, $GUI_SHOW)

GUICtrlCreateGroup("", 390, 90, 120, 150)
$label = GUICtrlCreateLabel("Sukurta Dirty_Bastard" & @CRLF & "           2005", 390, 20, 180, 50)
GUICtrlSetFont($label, 10, -1, -1, "Comic Sans MS")
GUICtrlSetColor($label, 0xFFFFFF)
GUICtrlCreateButton ("Isiusti", 160, 530, 280, 25)
;;;;/GUI

;###### CHILD
$child = GUICreate("Prideti nauja usakyma", 300, 300, -1, -1, $WS_BORDER, -1, $1)
$back2 = GUICtrlCreatePic ("newmark1.bmp", 0, 0, 300, 300)
$end = GUICtrlCreateButton ("Baigti", 10,10 ,100, 25)
$close = GUICtrlCreateButton ("Close", 10, 50 ,100, 25)

;; Veiksmai
While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $about
            MsgBox(32, "Apie", "Usakovas v" & $ver & @CRLF & @CRLF & "i programa pades usakyti norima paslauga i firmos " & $firma & "." & @CRLF & "(Detalesne informacija adresu: " & $address & ")" & @CRLF & @CRLF & "Telefonas: " & $tel & @CRLF & "WWW: " & $address & @CRLF & "@mail: " & $mail)
            
        Case $msg = $delete
            $sak = _GUICtrlListGetCaretIndex($sarasas)
            _GUICtrlListDeleteItem($sarasas, $sak)
            
        Case $msg = $new
            GUISetState(@SW_SHOW, $child)
            GUISetState(@SW_DISABLE, $1)
            
    ;; Button doesn't work!!!???
        Case $msg = $end
            MsgBox(4096 + 32, "aaa", "a")
    ;; /Button doesn't work!!!???
    EndSelect
    
    If $msg = $GUI_EVENT_CLOSE Or $msg = $exit OR $msg = $close Then
        IF WinActive($1) Then ExitLoop
        IF WinActive($child) Then
            GUISetState(@SW_ENABLE, $1)
            GUISetState(@SW_HIDE, $child)
        EndIf
    EndIf
Wend
    
GUIDelete() 
Exit

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