GUI - show, submit and recall Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Peter2
Posts: 243
Joined: 21 Sep 2014, 14:38
Location: CH

GUI - show, submit and recall

18 Jun 2019, 08:34

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
Peter (AHK Beginner) / Win 7 x64, AHK Version v1.1.22.xx
just me
Posts: 6527
Joined: 02 Oct 2013, 08:51
Location: Germany

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

18 Jun 2019, 08:46

  • Create the GUI only once.
  • Use GuiControl to (re)set the controls.
  • Use Gui, Show, ... to (re)show the GUI.
Peter2
Posts: 243
Joined: 21 Sep 2014, 14:38
Location: CH

Re: GUI - show, submit and recall

18 Jun 2019, 08:50

Incredible speed of solution!

Thanks to both :bravo: :beer:
Peter (AHK Beginner) / Win 7 x64, AHK Version v1.1.22.xx

Return to “Ask For Help”

Who is online

Users browsing this forum: A_Perry_1984, labrint, maxkill, Mipha, nacken012, relativity, Rohwedder, teadrinker and 215 guests