Jump to content

back button issue


Recommended Posts

  • Moderators

GodForsakenSoul ,

Need a bit more than that to offer any assistance. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

I believed you before I saw the video, but I still need to see the code if I am to help. ;)

M23

P.S. Why YouTube specially for me?

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

GodForsakenSoul,

I believed you before I saw the video, but I still need to see the code if I am to help. ;)

M23

P.S. Why YouTube specially for me?

do you want the entire file or is just the function allright?

there is no need for the main file as it just calls the function when the button is pressed so... yeah.

from what i see, you like things to be explain thoroughly. couldn't find a more thorough explanation then youtube :evil:

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

You explained the problem perfectly well, but without your code I cannot begin to help you find out what is wrong.

Post the whole thing, or PM it as Volly suggested. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

#include "Include\GUIConstants.au3"

Func GUIMAINGUI()
    GUICreate("Basic Japanes Training",550,250)
    Opt("GuiCoordMode", 0)
    $button1=GUICtrlCreateButton("Practice Conjugation", 20,20,200,20,$BS_CENTER)
    $Button2=GUICtrlCreateButton("Practice Kana", 0,20,200,20,$BS_CENTER)
    $button3=GUICtrlCreateButton("Options",0,20,200,20,$BS_CENTER)
    $button4=GUICtrlCreateButton("Exit",0,100,200,20,$BS_CENTER)
    GUISetState()

    while 1=1
        $msg=GUIGetMsg()
        Select
            Case $msg=$button1
                IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "1")
                Sleep(10)
                ExitLoop
            Case $msg=$Button2
                IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "2")
                Sleep(10)
                ExitLoop
            Case $msg=$button3
                IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "3")
                Sleep(10)
                ExitLoop
            Case $msg=$button4
                IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "4")
                Sleep(10)
                ExitLoop
            case $msg=$GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd
EndFunc

Func GUIPCON()
    GUICreate("Basic Japanese Training: Conjugation", 250, 200)
        
    Opt("GuiCoordMode",0)
    GUISetState()
EndFunc

Func GUIPKAN()
    GUICreate("Basic Japanese Training: Kana parctice", 250,250)
    Opt("GuiCoordMode",0)
    GUIStartGroup()
    $radiok1=GUICtrlCreateRadio("Hiragana only",20,20,150,15)
    $radiok2=GUICtrlCreateRadio("Katakana only",0,20,150,15)
    $radiok3=GUICtrlCreateRadio("Hiragana and katakana",0,20,150,15)
    GUIStartGroup()
    $labelk1=GUICtrlCreateLabel("Insert number of letters for training",10,20,100,50)
    $inputk1=GUICtrlCreateInput("",0,50,100,20)
    $buttonk1=GUICtrlCreateButton("Begin Training",10,20,80,20)
    $buttonkb=GUICtrlCreateButton("Back",0,20,150,20)
    GUISetState()
    
    while 1=1
        $msgkan=GUIGetMsg()
        Select
            Case $msgkan=$buttonk1
                $inputk1r=GUICtrlRead($inputk1)
                IniWrite("Data\OPT.INI","TRAINING","LOOPSNUMBER",$inputk1r)
;               GUIPKANSELECT()
                ExitLoop
            Case $msgkan=$buttonkb
                GUIMAINGUI()
                ExitLoop
            Case $msgkan=$GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd
EndFunc

;Func GUIPKANSTART()
;   GUICreate("Basic Japanese Trainig: Kana Practice",
;EndFunc

Func GUIOPT()
    GUICreate("Basic Japanese Training: Options", 550, 250)
    GUICtrlCreateLabel("Kana training options",20,20,150,20)
    $chkboxo1=GUICtrlCreateCheckbox("Show Images in Kana training",0,20,200,20)
    
    
    Opt("GuiCoordMode",0)
    GuiSetState()
    while 1=1
        $msgopt=GUIGetMsg()
        Select
            Case $msgopt=$GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd
EndFunc

here's the entire file. the problem lies (i think) in GUIPKAN().

there's a bunch of unfinished functions but they don't matter.

there is also a main file, but it simply reads a ini file with options, and calls the functions according to the options in it.

like a large if thingy if you will.

Link to comment
Share on other sites

OK, a few things I would do to make it easier:

First, I would have all the controls linked to ONE while loop.

Second - Use GUISetState to turn on and off the GUIs you are interacting with.

Third - You may want to look in either using tabs, or hiding controls when you do not need them.

I can help you fix it if you like, but I will need to see the entire thing to do it.

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul ,

This bit concerns me:

Case $msgkan=$buttonkb
                GUIMAINGUI()
                ExitLoop

With this you are calling the GUIMAINGUI() function as you go "Back" from the GUIPKAN() function. Is this what you want to do? Should you not go back to the "main file" - the one where you press F5 to get to GUIPKAN() ?

I would like to see the main file as well, please. ;)

I am also concerned with your GUIMAINGUI() function. You create a GUI, but never delete it - not good practice. You should either create the GUI elsewhere and then Hide/Show it as needed, or delete it as you leave the function. Otherwise you create a new GUI each time you call the function and will, eventually, run out of resources. Could I suggest adding something like this:

; Store the handle of the GUI
$hGUI = GUICreate("Basic Japanes Training",550,250)


; and then make the end of the function read
        EndSelect
    WEnd
    GUIDelete($hGUI)  ; Add this line
EndFunc

Now your GUI is deleted as you leave, freeing up the resources. :evil:

Looking forward to the next instalment. :evil:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

;main file as it currently exists
#include "Data\GUIMainGui.au3"

$file = FileOpen("Data\OPT.ini", 1)
; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
GUIMAINGUI()
$OPT=IniRead("Data\OPT.ini", "MAINGUI", "BUTTON", "-1")
Select
    Case $OPT=1
        GUIPCON()
    Case $OPT=2
        GUIPKAN()
    Case $opt=3
        GUIOPT()
    Case $OPT=4
        Exit
EndSelect

@M32: now here's a silly concern of mine:

if i delete, will i get it back next time i call GUIMAINGUI()?

that is exactly what i want to do. i want it to go back to GUIMAINGUI() rather then the main file because... frankly, i'm not sure how i'd use the main file.

if using the main file, however, is inevitable, i'm sure i'll come up with something.

@Volly: I have absolutely no clue (atm) how to use your first idea, nor the third.

i'm using scite 1.75. i'm not sure on the autoit version, but it's the newest i found at the time. less then 2 years i think...

#include "" is basically because i copied all the files from the include folder to @scriptdir\Data\Include to make the thing portable.

Link to comment
Share on other sites

Try this:

#include <GUIConstants.au3>
#include <ButtonConstants.au3>

Opt("GuiCoordMode",0)
DIM $gui1, $gui2, $gui3, $gui4, $button1, $button2, $button3, $button4
DIM $radiok1, $radiok2, $radiok3
DIM $labelk1, $inputk1, $buttonk1, $buttonkb
DIM $chkboxo1

_GUIMAINGUI()
 GUIPKAN()
 GUIPCON()
 GUIOPT()
GUISetState(@SW_HIDE,$gui2)
GUISetState(@SW_HIDE,$gui3)
GUISetState(@SW_HIDE,$gui4)
_whileloop()
Func _whileloop()
        while 1
        $msg=GUIGetMsg()
        Select
            case $msg=$GUI_EVENT_CLOSE
                $x = 1
                if WinActive($gui1) and $x = 1 then 
                    ExitLoop
                endif               
                if WinActive($gui2) then
                    GUISetState(@SW_HIDE,$gui2)
                    GUISetState(@SW_SHOW,$gui1)
                    $x = 0
                endif
                if WinActive($gui3) then
                    GUISetState(@SW_HIDE,$gui3)
                    GUISetState(@SW_SHOW,$gui1)
                    $x = 0
                endif               
                if WinActive($gui4) then
                    GUISetState(@SW_HIDE,$gui4)
                    GUISetState(@SW_SHOW,$gui1)
                    $x = 0
                endif               
            Case $msg = $button1
                IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "1")
                GUISetState(@SW_HIDE,$gui1)
                GUIPCON()
            Case $msg = $Button2
                IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "2") 
                GUISetState(@SW_HIDE,$gui1)
                GUIPKAN()
            Case $msg = $button3
                IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "3")
                GUISetState(@SW_HIDE,$gui1)
                GUIOPT()
            Case $msg = $button4
                IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "4")
                exitloop
            Case $msg = $buttonk1
                $inputk1r= GUICtrlRead($inputk1)
                IniWrite("Data\OPT.INI","TRAINING","LOOPSNUMBER",$inputk1r)
                msgbox(0, "", "Begin your training")
;               GUIPKANSELECT()
            Case $msg=$buttonkb
                GUISetState(@SW_HIDE,$gui2)
                GUISetState(@SW_SHOW,$gui1)
            Case $msg = $chkboxo1
                msgbox(0, "", "you either checked or unchecked this box")
                
        EndSelect
    WEnd
EndFunc

Func _GUIMAINGUI()
    $gui1 = GUICreate("Basic Japanes Training",550,250)
    Opt("GuiCoordMode", 0)
    $button1=GUICtrlCreateButton("Practice Conjugation", 20,20,200,20,$BS_CENTER)
    $Button2=GUICtrlCreateButton("Practice Kana", 0,20,200,20,$BS_CENTER)
    $button3=GUICtrlCreateButton("Options",0,20,200,20,$BS_CENTER)
    $button4=GUICtrlCreateButton("Exit",0,100,200,20,$BS_CENTER)
    GUISetState(@SW_SHOW,$gui1)
EndFunc

Func GUIPKAN()
    $gui2 = GUICreate("Basic Japanese Training: Kana parctice", 250,250)
    Opt("GuiCoordMode",0)
    GUIStartGroup()
    $radiok1=GUICtrlCreateRadio("Hiragana only",20,20,150,15)
    $radiok2=GUICtrlCreateRadio("Katakana only",0,20,150,15)
    $radiok3=GUICtrlCreateRadio("Hiragana and katakana",0,20,150,15)
    GUIStartGroup()
    $labelk1=GUICtrlCreateLabel("Insert number of letters for training",10,20,100,50)
    $inputk1=GUICtrlCreateInput("",0,50,100,20)
    $buttonk1=GUICtrlCreateButton("Begin Training",10,20,80,20)
    $buttonkb=GUICtrlCreateButton("Back",0,20,150,20)
    GUISetState(@SW_SHOW,$gui2)
EndFunc

Func GUIPCON()
    $gui3 = GUICreate("Basic Japanese Training: Conjugation", 250, 200)
    Opt("GuiCoordMode",0)
    GUISetState(@SW_SHOW,$gui3)
EndFunc

;Func GUIPKANSTART()
;   GUICreate("Basic Japanese Trainig: Kana Practice",
;EndFunc

Func GUIOPT()
    $gui4 = GUICreate("Basic Japanese Training: Options", 550, 250)
    GUICtrlCreateLabel("Kana training options",20,20,150,20)
    $chkboxo1=GUICtrlCreateCheckbox("Show Images in Kana training",0,20,200,20)
    GUISetState(@SW_SHOW,$gui4)
EndFunc
Link to comment
Share on other sites

i'm using scite 1.75. i'm not sure on the autoit version, but it's the newest i found at the time. less then 2 years i think...

Checking your AutoIt version is easy:

MsgBox(262208, "AutoIt version is:", @AutoItVersion)

Or open the helpfile and read the version there. Or the version on AutoIt.exe

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...