Page 1 of 1

GUI - show, submit and recall

Posted: 18 Jun 2019, 08:34
by Peter2
I have a (maybe stupid) mistake in my code-structure. The simple idea is

- show a GUI-dialogue
- press a button
- GUI disappears, something is done
- GUI should be displayed again
-->> And here I get the message that a variable cannot be defined twice ...

What's wrong? Here is the structure of the code

Code: Select all

#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
Gosub, Fensteraufbau
return  ; Ende Hauptprogramm

;; *************************************
Fensteraufbau:
Gui Add, Text,      x200    y20     w120 h23 +Disabled +0x200,   Wasser
....
Gui Add, Button,    x30     y450    w100 h23 gStarten, &Starten
Gui Add, Button,    x150    y450    w100 h23 gLogzeigen, &Log anzeigen
Gui Add, Button,    x270    y450    w100 h23 gBeenden, &Beenden

Gui, Color, EBF4FA
Gui Show, w430 h500, 1-Klick
Return
;; *************************************
Logzeigen:
    Run, %A_ScriptDir%\Gesamtlog.log
return
;; *************************************
Starten:
...
    Gui,Submit
        If gawa=1
        {
            Gosub, Wartungslauf
        }
Gosub, Fensteraufbau
return
;; *************************************
Wartungslauf:
....do something
return
;; *************************************
GuiEscape:
GuiClose:
Beenden:
    ExitApp
return

Re: GUI - show, submit and recall  Topic is solved

Posted: 18 Jun 2019, 08:46
by just me
  • Create the GUI only once.
  • Use GuiControl to (re)set the controls.
  • Use Gui, Show, ... to (re)show the GUI.

Re: GUI - show, submit and recall

Posted: 18 Jun 2019, 08:50
by Peter2
Incredible speed of solution!

Thanks to both :bravo: :beer: