Jump to content

Two Gui windows


vickerps
 Share

Recommended Posts

Is it possible to create two gui windows to interact with each other

For example i want Guicreate (window1) to launch Guicreate(window2) and once finished on window2 to return to window 1

Basically i have to much info to go all on one window so i thought i could to create another window to display the other info and then close it return back to main window.

i hope this makes sense

Link to comment
Share on other sites

Is it possible to create two gui windows to interact with each other

For example i want Guicreate (window1) to launch Guicreate(window2) and once finished on window2 to return to window 1

Basically i have to much info to go all on one window so i thought i could to create another window to display the other info and then close it return back to main window.

i hope this makes sense

<{POST_SNAPBACK}>

Yes you create 2 GUI with GuiCreate and you use GuiSwitch/GuiSetState when needed. :idiot:
Link to comment
Share on other sites

Thanks guys

However That multigui doesn't make any sense because it dosn't seem to do anything

The child of parent 1 just stay on stop of parent1

cannot close child of parent 1

can get to parent2 but cannot close

Does any have another simple script i can use for Comparison.

Jpm i saw that GuiSwitch in the read file but can't get it to work. i want say a button as a trigger on the parrent 1 to open child of parrent 1 and then a button on child of parrent1 to return back to parrent1

Edited by vickerps
Link to comment
Share on other sites

Jpm i saw that GuiSwitch in the read file but can't get it to work. i want say a button as a trigger on the parrent 1 to open child of parrent 1 and then a button on child of parrent1 to return back to parrent1

<{POST_SNAPBACK}>

If I understand you correctly you may want to have something like this:

#include "GUIConstants.au3"

Opt("GUICoordMode",2)
Opt("GuiResizeMode", 1)

$parent1 = GuiCreate("Parent1")
GuiSetBkColor(0xCCCCFF)
$switch1 = GUICtrlCreateButton ("SWITCH",  10, 30, 70)
GuiSetState(@SW_SHOW)

$parent2 = GuiCreate("Parent2")
GuiSetBkColor(0xCCCCFF)
$switch2 = GUICtrlCreateButton ("SWITCH",  10, 30, 70)
GuiSetState(@SW_HIDE)

While 1
    $msg = GuiGetMsg(1) ; Get extra info in an array

; Only close if the X was clicked
    If $msg[0] = $GUI_EVENT_CLOSE Then ExitLoop
  
; Only interested in messages for childof1
    If $msg[1] = $parent1 Then      
        If $msg[0] = $switch1 Then
            GUISetState(@SW_HIDE, $parent1)
            GUISetState(@SW_SHOW, $parent2)
        EndIf
    EndIf
    If $msg[1] = $parent2 Then      
        If $msg[0] = $switch2 Then
            GUISetState(@SW_HIDE, $parent2)
            GUISetState(@SW_SHOW, $parent1)
        EndIf
    EndIf

Wend

It uses GUISetState() to "switch" between the windows.

Link to comment
Share on other sites

If I understand you correctly you may want to have something like this:

It uses GUISetState() to "switch" between the windows.

<{POST_SNAPBACK}>

Yes you can even Hide the window without deleting if you neet by GuiSetState(@SW_HIDE,$winID) :idiot:
Link to comment
Share on other sites

Thanks that helped a lot However I now have a refresh prob. i a bit hard to explain so here the code. basically if you click the eft config button and then click the eft checkbox it should enable the HSBC check box. It does this but it flickers between enable and disable. I think it something to do with the speed the loop take to refresh. anyway can someone have a look for me.

#include <GUIConstants.au3>

$customer = ""
$Version =" V1.2"
; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------

$parent1 = GuiCreate($Customer&$Version,415,360,-1,-1,$WS_BORDER,$WS_EX_ACCEPTFILES)

$filemenu = GUICtrlCreateMenu ("&File")
GUICtrlSetState(-1,$GUI_DEFBUTTON)
$helpmenu = GUICtrlCreateMenu ("&Help")
$infoitem = GUICtrlCreateMenuitem ("&Info",$helpmenu)
$exititem = GUICtrlCreateMenuitem ("E&xit",$filemenu)

GUICtrlCreateGroup ("Menu's", 10, 10,275,170)

$PosCombo = GUICtrlCreateCombo("",90,30,80,-1)
        GUICtrlSetData($PosCombo,"Back Office|Till","Till")

$MakeCombo =    GUICtrlCreateCombo("", 90,60,80,-1)
        GUICtrlSetData($MakeCombo,"DIGIPOS|BEETLE|COMPAQ|STONE","DIGIPOS")
    
$ModelCombo =   GUICtrlCreateCombo("", 215,60,60)
        GUICtrlSetData($ModelCombo,"3000|PowerPos","3000")

$BrandCombo =   GUICtrlCreateCombo("", 90,80,80,-1)
        GUICtrlSetData($BrandCombo,"Instore|£-Stretcher","Instore")

$TillNoInput =  GUICtrlCreateInput("1",215,30,40,20)
$TillNoupdown = GUICtrlCreateUpdown($TillNoInput,$UDS_ARROWKEYS+$UDS_WRAP)
        GUICtrlSetLimit ( $TillNoupdown, 9 , 1 )


$TotalTillsInput =  GUICtrlCreateInput("1",90,110,40,20)
$TotalTillsupdown=  GUICtrlCreateUpdown ($TotalTillsInput,$UDS_ARROWKEYS+$UDS_WRAP)
            GUICtrlSetLimit ($TotalTillsupdown, 9 , 1 )

$SerialInput =  GUICtrlCreateInput("",90,140,170,20)


GUICtrlCreateGroup ("Branch", 10, 180,400,80)


$BranchInput=   GUICtrlCreateInput("", 90, 200, 30,20)

$BranchNameInput= GUICtrlCreateInput("", 90, 230, 100,20)

$FloatLevelInput= GUICtrlCreateInput("1000", 260, 200, 50,20)

$BankCombo =    GUICtrlCreateCombo("", 260, 230,80,80)
        GUICtrlSetData($BankCombo,"HSBC|GIROBANK","HSBC")
        

        GUICtrlCreateLabel ("POS", 20, 30, 60, 20)
        GUICtrlCreateLabel ("Make of PC", 20, 60, 60, 20)
        GUICtrlCreateLabel ("Model", 175, 60, 40, 20)
        GUICtrlCreateLabel ("TillNo", 175, 30, 40, 20)
        GUICtrlCreateLabel ("Brand Name", 20, 80, 60, 20)
        GUICtrlCreateLabel ("Till Total", 20, 110, 50,30)
        GUICtrlCreateLabel ("Serial Number", 20, 140, 50,30)
        GUICtrlCreateLabel ("Branch", 20, 200, 50, 20)
        GUICtrlCreateLabel ("BranchName", 20, 230, 65, 20)
        GUICtrlCreateLabel ("FloatLevel", 200, 200, 60, 20)
        GUICtrlCreateLabel ("Bank", 200, 230, 40, 20)

GUICtrlCreateGroup ("Menu's", 310, 10,100,170)

$EFTButton =        GUICtrlCreateButton("EFT Config", 320, 30, 80, 40)
$NetworkButton =  GUICtrlCreateButton("Network Config", 320, 75, 80, 40)
$DateTimeButton=  GUICtrlCreateButton("Date && Time", 320, 120, 80, 40)


$OkButton = GUICtrlCreateButton("OK", 230, 270, 80, 40)
$ExitButton = GUICtrlCreateButton ( "Exit", 320, 270, 80, 40)

GUISetState(@SW_show)
;-----------------------------------------------------------------------

$EftForm = GuiCreate($Customer&$Version,450,340,-1,-1,$WS_BORDER,$WS_EX_ACCEPTFILES)

$filemenu = GUICtrlCreateMenu ("&File")
GUICtrlSetState(-1,$GUI_DEFBUTTON)
$helpmenu = GUICtrlCreateMenu ("&Help")
$infoitem = GUICtrlCreateMenuitem ("&Info",$helpmenu)
$exititem = GUICtrlCreateMenuitem ("E&xit",$filemenu)

        GUICtrlCreateGroup ("Enable", 10, 10,190,70)

$EftCheckBox =  GUICtrlCreateCheckbox ("EFT / Router Attached",20,30,170,20)
$EpsCheckBox =  GUICtrlCreateCheckbox ("EtopUp (EPS)",20,50,90,20)
    
$EtopupMid =    GUICtrlCreateInput ("", 100, 90, 100, 20)
        GUICtrlCreateLabel ("MID For ETopUP", 10, 100, 90,30)
    
$EtopupTID =    GUICtrlCreateInput ("", 100, 120, 100, 20)
        GUICtrlCreateLabel("TID For ETopUP", 10, 130, 80,30)
        
$SolveTid =     GUICtrlCreateEdit ("", 10,170,190,120)      
        GUICtrlCreateLabel ("TIDs For Solve", 10, 150, 90, 20)
        
GUICtrlCreateGroup ("Providers", 220, 10,220,230)
    
$Hsbc        = GUICtrlCreateCheckbox ("HSBC",230,30,100,20)
                                        
$HsbcInput   = GUICtrlCreateInput ("", 330, 30, 100, 20)
                        
$AmericanExp     = GUICtrlCreateCheckbox ("American Exp",230,55,100,20)
                
$AmericanExpInput= GUICtrlCreateInput("", 330, 55, 100, 20)
                            
$Diners      = GUICtrlCreateCheckbox ("Diners",230,80,100,20)
                   
$DinersInput     = GUICtrlCreateInput ("", 330, 80, 100, 20)
                  
$Jcb         = GUICtrlCreateCheckbox ("JCB",230,105,100,20)
                   
$JcbInput    = GUICtrlCreateInput( "", 330,105, 100, 20)
                  
$Style       = GUICtrlCreateCheckbox ("Style",230,130,100,20)
            
$StyleInput  = GUICtrlCreateInput ("", 330,130, 100, 20)
                   
$Transax     = GUICtrlCreateCheckbox ("Transax",230,155,100,20)
                          
$TransaxInput    = GUICtrlCreateInput ("", 330, 155, 100, 20)
                  
$PayPoint    = GUICtrlCreateCheckbox ("PayPoint",230,180,100,20)
                      
$PayPointInput   = GUICtrlCreateInput ("", 330,180,100,20)
                   
$Equifax     = GUICtrlCreateCheckbox ("Equifax",230,205,100,20)
            
$EquifaxInput = GUICtrlCreateInput ("", 330,205,100,20)
 
$CloseButton =      GUICtrlCreateButton ("Close", 220, 250, 220, 40)

;-------------------------------------------------------------------
While 1
$msg = GUIGetMsg(1)

 If $msg[1] = $EftForm Then     
       
    GUICtrlSetState ( $Hsbc, $GUI_DISABLE )

    IF GUICtrlRead ($EftCheckbox) = $GUI_CHECKED Then
        GUICtrlSetState ( $Hsbc, $GUI_Enable )
        Endif
  EndIf


Select

    Case $msg[0] = $EFTButton
            GUISwitch($EftForm)
        GUISetState(@SW_SHOW)

    Case $msg[0] = $OkButton
        
 
    Case $msg[0] = $ExitButton
        Exit

    Case $msg[0] = $closeButton
        GUISetState(@SW_Hide)
        GUISwitch($parent1)
     

  EndSelect
WEnd
Link to comment
Share on other sites

Hmm I am running it on Nt4 SP6a

However I have just tried it on Xp sp2

and it does the same. It might be you might not see the flickering it is very fast. However when you go into eft config click on enable eft and then try and click the HSBC checkbox. It won't let you which i think is because the state value is in flux

Edited by vickerps
Link to comment
Share on other sites

Hi guys

Just tried one with everything on one form. This does the same most of the control flicker. This become more clearer when you click either of the checkbox's

If you cannot see the flickering try clicking the eft checkbox to enable the edit box and then try typing something into the edit box.

I tried this script on nt4 and xp both do the same although flickering is mostly on the nt system for some reason

#include <GUIConstants.au3>
#INCLUDE <Process.au3>
#INCLUDE <file.au3>

$customer = ""
$Version =" V1.2"

Global $temp

IF FileExists ("d:\utility\system.bak") THEN FileCopy("d:\utility\system.bak","d:\utility\system.dfn",1)
FileDelete ( "d:\utility\Till*.ini" )
FileDelete ( "d:\utility\Till*.log" ) 
FileDelete ( "d:\utility\back office99*.log" ) 

; ----------------------------------------------------------------------------
; Set up our defaults
; ----------------------------------------------------------------------------
;SUBNET_GATEWAY()

;SplashImageOn( -1, "D:\utility\800h.bmp",@DeskTopWidth,@DeskTopHeight,-1,-1,3) 

; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------
AutoItSetOption ( "GUICoordMode", 1 )
;AutoItSetOption ( "GUIOnEventMode", 1 )
GUICreate($Customer&$Version,500,420,-1,-1)

$PosCombo = GUICtrlCreateCombo("POS", 80,20,80,-1)
        GUICtrlSetData($PosCombo,"Back Office|Till","Till")

$MakeCombo =    GUICtrlCreateCombo("Make of PC", 80,50,80,-1)
        GUICtrlSetData($MakeCombo,"DIGIPOS|BEETLE|COMPAQ|STONE","DIGIPOS")
        
$ModelCombo =   GUICtrlCreateCombo("Model", 210,50,60)
        GUICtrlSetData($ModelCombo,"3000|PowerPos","3000")

$TillNoInput =  GUICtrlCreateInput("1", 210,20,40,-1)
$TillNoUpDown = GUICtrlCreateUpdown($TillNoInput)
        

$BrandCombo =   GUICtrlCreateCombo("Brand", 80,80,80,-1)
        GUICtrlSetData($BrandCombo,"Instore|£-Stretcher","Instore")

        GUICtrlCreateLabel("POS", 20, 20, 60, 20)
        GUICtrlCreateLabel("TillNo", 170, 20, 40, 20)
        GUICtrlCreateLabel("Make of PC", 20, 50, 60, 20)        
        GUICtrlCreateLabel("Model", 170, 50, 40, 20)
        GUICtrlCreateLabel("Brand Name", 20, 80, 60, 20)

$TotalTillsInput = GUICtrlCreateInput ("1",80,110,60,20)
$TotalTillsUpDown= GUICtrlCreateUpdown ($TotalTillsInput)
        

$EftCheckbox =  GUICtrlCreateCheckbox ("Enable EFT",170,90,90,20)
$EpsCheckbox =  GUICtrlCreateCheckbox ("Enable EPS",170,110,90,20)
        
$SerialInput =  GUICtrlCreateInput ("",80,140,170,20)
        GUICtrlCreateLabel ("Serial Number", 20, 140, 50,30)
                
$EtopUpMid =    GUICtrlCreateInput ("", 110, 180, 80, 20)
        GUICtrlCreateLabel ("MID For ETopUP", 20, 180, 90,30)
        
$EtopUpTid =    GUICtrlCreateInput ("", 110, 210, 80, 20)
        GUICtrlCreateLabel ("TID For ETopUP", 20, 210, 80,30)
        
$SolveMid = GUICtrlCreateInput ("", 110, 240, 80, 20)
        GUICtrlCreateLabel ("MID For Solve", 20, 240, 70, 30)
                
$SolveTid =     GUICtrlCreateEdit ("", 10,310,270,100)      
        GUICtrlCreateLabel ("TIDs For Solve", 10, 270, 70, 30)
        
GUICtrlCreateTab( "", 280, 10, 220, 160)

GUICtrlCreateTabItem ("IP Address")

$ComputerName = GUICtrlCreateInput (@computername, 380, 45, 80,20)
        GUICtrlCreateLabel ("ComputerName", 285, 45, 80, 20)

$IP =       GUICtrlCreateInput (@ipaddress1, 380, 80, 100, 20)
        GUICtrlCreateLabel ("IP Address", 285, 80, 80, 20)
        
$Subnet =   GUICtrlCreateInput ("$Subnet_ok", 380, 105, 100, 20)
        GUICtrlCreateLabel ("Subnet Mask", 285, 105, 80, 20)
        
$gateway =  GUICtrlCreateInput ("$gateway_ok", 380, 130, 100, 20)
        GUICtrlCreateLabel ("Default Gateway", 285, 130, 80, 20)
        
GUICtrlCreateTabItem ("INI Configuration")

$BRANCH=    GUICtrlCreateInput ("", 380, 45, 30,20)
        GUICtrlCreateLabel ("Branch", 285, 45, 80, 20)
        
$BRANCHName=    GUICtrlCreateInput ("", 380, 70, 100,20)
        GUICtrlCreateLabel ("BranchName", 285, 70, 80, 20)

$StoreFloatLevel=GUICtrlCreateInput ("1000", 380, 95, 50,20)
        GUICtrlCreateLabel ("StoreFloatLevel", 285, 95, 80, 20)
        
$BANK =     GUICtrlCreateCombo ("", 380, 120,80,80)
        GUICtrlSetData($BANK,"HSBC|GIROBANK","HSBC")
        GUICtrlCreateLabel ("Bank", 285, 120, 40, 20)
    
GUICtrlCreateTabItem ("")

        GUICtrlCreateLabel ("TIME", 310, 200, 40, 20)
$I_Time =   GUICtrlCreateDate ("", 350, 200, 80, 30,0x09)

        GUICtrlCreateLabel ("DATE", 310, 250, 40, 20)
$I_Date =   GUICtrlCreateDate  ("", 350, 250, 85, 30,0x00)
        
$OkButton =         GUICtrlCreateButton ("Ok", 300, 340, 80, 40)

$ExitButton =       GUICtrlCreateButton ("Exit", 400, 340, 80, 40)
    
GUISetState (@Sw_Show)


    
While 1

$Msg = GUIGetMsg(1)

IF GUICtrlRead ($MakeCombo) ="DIGIPOS" Then 
    
    GUICtrlSetState($ModelCombo,$Gui_Enable)
    
ELSE        
    GUICtrlSetState($ModelCombo,$Gui_Disable)
    
    ENDIF

IF GUICtrlRead ($PosCombo) ="BACK OFFICE" Then
            
    GUICtrlSetState($SolveMid,$Gui_Enable)
    GUICtrlSetState($SolveTid,$Gui_Enable)
        
    GUICtrlSetState($TillNoInput,$Gui_Disable)
    
    GUICtrlSetState($SerialInput,$Gui_Disable)
        
ELSEIF GUICtrlRead ($PosCombo) ="TILL" Then

    GUICtrlSetState($EftCheckbox,$GUI_ENABLE)
    GUICtrlSetState($SolveMid,$GUI_DISABLE) 
    GUICtrlSetState($SolveTid,$GUI_DISABLE)
    GUICtrlSetState($TillNoInput,$GUI_ENABLE)
    GUICtrlSetState($SerialInput,$GUI_DISABLE)
    ENDIF

IF GUICtrlRead ($EftCheckbox) = $GUI_CHECKED Then

    GUICtrlSetState($SolveMid,$GUI_ENABLE)
    GUICtrlSetState($SolveTid,$GUI_ENABLE)
    
ELSEIF GUICtrlRead ($EftCheckbox) = $GUI_UNCHECKED Then

    GUICtrlSetState($SolveMid,$GUI_DISABLE) 
    GUICtrlSetState($SolveTid,$GUI_DISABLE)
    Endif

IF GUICtrlRead ($EpsCheckbox) = $GUI_CHECKED Then

    GUICtrlSetState($EtopUpMid,$GUI_ENABLE)
    
    GUICtrlSetState($EtopUpTid,$GUI_ENABLE)
    
ELSEIF GUICtrlRead ($EpsCheckbox) = $GUI_UNCHECKED Then

    GUICtrlSetState($EtopUpMid,$GUI_DISABLE)
    GUICtrlSetState($EtopUpTid,$GUI_DISABLE)
    
    Endif

SELECT 

Case $msg[0]= $OKButton

    $Serial_Ok = StringLen (GUICtrlRead($SerialInput))
    $ETOPUP_MID_Ok= StringLen (GUICtrlRead($EtopUpMid))
    $ETOPUP_TID_Ok= StringLen (GUICtrlRead($EtopUpTid))
    $Solve_MID_Ok= StringLen (GUICtrlRead($SolveMid))
    $Solve_TID_ok= StringLen (GUICtrlRead($SolveTid))
    $Branch_ok= StringLen (GUICtrlRead($BranchMid))
    $StoreFloatLevel_Ok = StringLen (GUICtrlRead($StoreFloatLevel))
    $Comp_TillNo_Ok = StringRight ( GUICtrlRead($computername), 1 )

IF GUICtrlRead ($PosCombo) ="BACK OFFICE" THEN

    IF $Serial_Ok <>29 THEN 
        Msgbox(16,"","You Must Enter A Valid Serial Number")
        CONTINUELOOP
        ENDIF

ELSEIF GUICtrlRead ($PosCombo) ="Till" THEN

    IF  (GUICtrlRead($TillNoInput)) > (GUICtrlRead($TotalTillsInput)) OR (GUICtrlRead($TillNoInput)) = 0 Then 
        Msgbox(16,"","Incorrect Till Number")
        CONTINUELOOP
        ENDIF

    IF  ($Comp_TillNo_Ok) <> (GUICtrlRead($TillNoMid)) Then 
        Msgbox(16,"","Incorrect Till Number or ComputerName")
        CONTINUELOOP
        ENDIF

    ENDIF

IF  GUICtrlRead ($EftCheckbox) = $GUI_CHECKED Then 
            
    IF $Solve_MID_Ok <8 OR $Solve_TID_ok <8 Then
        Msgbox(16,"","You Must Enter A Valid Solve number")
        CONTINUELOOP
        ENDIF
    ENDIF

IF  GUICtrlRead ($checkEps) = $GUI_CHECKED Then 
            
    IF $ETOPUP_MID_Ok <>15 OR $ETOPUP_TID_Ok <8 Then
        Msgbox(16,"","You Must Enter A Valid EPS number")
        CONTINUELOOP
        ENDIF
    ENDIF

IF $Branch_ok <>3 OR $StoreFloatLevel_Ok <> 4 THEN 
    Msgbox(16,"","INI Configuration section incorrect")
    CONTINUELOOP
    ENDIF

EXITLOOP

Case $msg[0] = $ExitButton
   Exit

EndSelect
WEnd
Link to comment
Share on other sites

Hmm I am running it on Nt4 SP6a

However I have just tried it on Xp sp2

and it does the same. It might be you might not see the flickering it is very fast. However when you go into eft config click on enable eft and then try and click the HSBC checkbox. It won't let you which i think is because the state value is in flux

<{POST_SNAPBACK}>

this code
If $msg[1] = $EftForm Then      
       
    GUICtrlSetState ( $Hsbc, $GUI_DISABLE )

    IF GUICtrlRead ($EftCheckbox) = $GUI_CHECKED Then
        GUICtrlSetState ( $Hsbc, $GUI_Enable )
        Endif
  EndIf
is not what I say a flickering pb it just react to what you intend.

every click related to second GUI put the $Hsbc control in the disable tate check if the $EftCheckbox is checked and in this case set back the $Hsbc in the enable state.

From my point of view every click do a little flickering perhaps we can avoid that but I am not sure

Link to comment
Share on other sites

Is it possible to create two gui windows to interact with each other

For example i want Guicreate (window1) to launch Guicreate(window2) and once finished on window2 to return to window 1

Basically i have to much info to go all on one window so i thought i could to create another window to display the other info and then close it return back to main window.

i hope this makes sense

<{POST_SNAPBACK}>

Hello test this code i hope you like it! :idiot:

#include "GUIConstants.au3"

Opt("GUICoordMode",2)
Opt("GuiResizeMode", 1)

$parent1 = GuiCreate("DirtyBanditos1")
GuiSetBkColor(0xCCCCFF)
$ok1 = GUICtrlCreateButton ("OK",  10, 30, 50)
$cancel1 = GUICtrlCreateButton ( "Cancel",  0, -1)
$label1 = GuiCtrlCreateLabel("My label!", 0, -1)
$edit1 = GuiCtrlCreateInput("Enter text", 0, -1, 100)
GuiCtrlSetColor(-1, 0xffffff)
GuiCtrlSetBkColor($label1, 0x0000ff)
GuiSetState(@SW_SHOW)

$parent2 = GuiCreate("DirtyBanditos2", -1, -1, -1, -1, BitOr($WS_OVERLAPPEDWINDOW, $WS_SIZEBOX))
GuiSetBkColor(0xFFCCCC)
GuiSetCursor(4)
$ok2 = GUICtrlCreateButton ("OK",  10, 30, 50)
$cancel2 = GUICtrlCreateButton ( "Cancel",  0, -1)
GuiSetState(@SW_SHOW)

$childof1 = GuiCreate("DirtyBanditos1", -1, -1, -1, -1, -1, -1, $parent1)
GuiSetBkColor(0xDDDDFF)
$ok3 = GUICtrlCreateButton ("OK",  10, 30, 50)
$cancel3 = GUICtrlCreateButton ( "Cancel",  0, -1)
$primary = GUICtrlCreateButton ( "0",  0, -1)
$secondary = GUICtrlCreateButton ( "0",  0, -1)
GuiSetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg(1)    ; Get extra info in an array

; Only close if the X was clicked on parent1
    If $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $parent1 Then ExitLoop
  
; Only interested in messages for childof1
    If $msg[1] = $childof1 Then
        
        If $msg[0] = $GUI_EVENT_MOUSEMOVE Then
            GuiCtrlSetData($ok3, $msg[3])
            GuiCtrlSetData($cancel3, $msg[4])
        EndIf

        If $msg[0] = $GUI_EVENT_PRIMARYDOWN Then GuiCtrlSetData($primary, "1")
        If $msg[0] = $GUI_EVENT_PRIMARYUP Then GuiCtrlSetData($primary, "0")
        If $msg[0] = $GUI_EVENT_SECONDARYDOWN Then GuiCtrlSetData($secondary, "1")
        If $msg[0] = $GUI_EVENT_SECONDARYUP Then GuiCtrlSetData($secondary, "0")

    EndIf

Wend
Edited by DirtyBanditos
Link to comment
Share on other sites

this code

If $msg[1] = $EftForm Then        
       
    GUICtrlSetState ( $Hsbc, $GUI_DISABLE )

    IF GUICtrlRead ($EftCheckbox) = $GUI_CHECKED Then
        GUICtrlSetState ( $Hsbc, $GUI_Enable )
        Endif
  EndIf
is not what I say a flickering pb it just react to what you intend.

every click related to second GUI put the $Hsbc control in the disable tate check if the $EftCheckbox is checked and in this case set back the $Hsbc in the enable state.

From my point of view every click do a little flickering perhaps we can avoid that but I am not sure

<{POST_SNAPBACK}>

Thanks jpm but i think your missing my prob. The flickering isn't the main problem it was just one of the visual simptoms. The problem is using the first code i posted. When you check the $eftcheckbox it is suppose to make the $hsbc checkbox go from a disabled state to an enable state so that the user has the option to either check it or uncheck it. However it won't let u. I just thought because it is flickering it might be because the checkbox is going from a disabled state to an enable state very quckly. Can you please confirm weather you can check / uncheck the $HSBC checkbox at will, once you have enabled the $EFTcheckbox.

Please help me... You're my only hope....

Link to comment
Share on other sites

Thanks jpm but i think your missing my prob. The flickering isn't the main problem it was just one of the visual simptoms. The problem is using the first code i posted. When you check the $eftcheckbox it is suppose to make the $hsbc checkbox go from a disabled state to an enable state so that the user has the option to either check it or uncheck it. However it won't let u. I just thought because it is flickering it might be because the checkbox is going from a disabled state to an enable state very quckly. Can you please confirm weather you can check / uncheck the $HSBC checkbox at will, once you have enabled the $EFTcheckbox.

Please help me... You're my only hope....

<{POST_SNAPBACK}>

Oh, I see.

You have a logic problem because when there is a meesage coming from the form you always set the $HSBC state to disable that mean you reset the checked state.

Remember there is only one state which include disable and check

I wouls have written a logic related to one control instead of form.

You don't really need to use $msg[1] only in very special case.

your loop can be because id are unique for the whole script

While 1
$msg = GUIGetMsg()

If $msg = $EftCheckbox Then     
       
    GUICtrlSetState ( $Hsbc, $GUI_DISABLE )

    IF GUICtrlRead ($EftCheckbox) = $GUI_CHECKED Then
        GUICtrlSetState ( $Hsbc, $GUI_Enable )
        Endif
  EndIf


Select

    Case $msg = $EFTButton
            GUISwitch($EftForm)
        GUISetState(@SW_SHOW)

    Case $msg = $OkButton
        

    Case $msg = $ExitButton
        Exit

    Case $msg = $closeButton
        GUISetState(@SW_Hide)
        GUISwitch($parent1)
     

  EndSelect
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...