Jump to content

back button + radio controls


Recommended Posts

problem 1:

i noticed now that my proggy has only one run before it shuts down. i find it slightly inconvenient.

here's an example on how it exists. there are no actual troubles with this part.

Case $msg=$button4
                IniWrite("Data\OPT.INI", "MAINGUI", "BUTTON", "4")
                Sleep(10)
                ExitLoop

i want to add a "back" button, in case the user decides he wants to fiddle with it some more.

the problem lies within the fact i can't figure it out myself. help is most welcome. ;)

problem2:

i want to have radio button things to make some choices. i can't figure out how to make only one active. meaning, if you picked 2, but then decided you want 1, 2 unchecks itself. once again, don't have the slightest clue on how to do it. helpfile doesn't quite offer any suggestions on the topic. as always, i'd love your ideas. :evil:

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

Answer to Problem 1. It is pretty easy to incorporate a "Back" button, but we would need to see a lot more of the script structure before we could begin making any sensible suggestions on how you might do it.

Answer to Problem 2.

helpfile doesn't quite offer any suggestions on the topic. as always

Hmmm. ;) Did you look at GUICtrlCreateGroup or GUIStartGroup? They are the key to what you want to do. :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

#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", 550, 250)
    Opt("GuiCoordMode",0)
    GUISetState()
EndFunc

Func GUIPKAN()
    GUICreate("Basic Japanese Training: Kana parctice",250,150)
    Opt("GuiCoordMode",0)
    $buttonk1=GUICtrlCreateButton("Show Animation",50,20,150,20,$BS_CENTER)
    $buttonk2=GUICtrlCreateButton("Don't Show animation",0,20,150,20,$BS_CENTER)
    $labelk1=GUICtrlCreateLabel("Please select how many times you would like to excersize", 0,30,150,50)
    $inputk1=GUICtrlCreateInput("",0,40,100,20) 
    GUISetState()
    
    while 1=1
        $msgkan=GUIGetMsg()
        Select
            Case $msgkan=$buttonk1
                IniWrite("Data\OPT.INI", "KANA", "BUTTON", "1")
                $getinputk=GUICtrlRead($inputk1,0)
                sleep(10)
                ExitLoop
            Case $msgkan=$buttonk2
                IniWrite("Data\OPT.INI","KANA", "BUTTON", "2")
                sleep(10)
                ExitLoop
            Case $msgkan=$GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd
EndFunc

here's my whole gui script. it relies heavily on a INI file, but still. i believe someone of your level will have no trouble understanding it.

just looked at GuiCtrlCreateGroup(). thanks. ;)

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

someone of your level will have no trouble understanding it

Sorry to disillusion you but I have no idea what the script is supposed to do. What you have posted consists of 3 functions which set options in an ini file. There is no master script to call them and so they will never execute - did you actually try running this script? It merely opens and then closes.....(once you fix the errors :idea: )

In addition, the #include line is wrongly contructed. I thought you had understood earlier today that everything is related to the script you are running. So in your code you are asking to include a file held in the \Include folder of the folder in which your script is situated, which I am fairly sure is not what you thought you were doing. Please go and read the Help file page on #include to understand the difference between putting <> or "" around an #include file. And it is not even named correctly - it has been GUIConstantsEx.au3 since 16 May 2008 and the release of v3.2.12.0. On top of that you are missing an #include file - ButtonConstants.au3 - which defines $BS_CENTER.

Please do not take this the wrong way, but you need to take all this a bit more slowly. You are firing questions at this forum at a pretty high rate, but I am unconvinced that you are absorbing the knowledge you are getting in the replies. It might serve you better in the long run to take a step back and try and understand a bit more of the inner workings of Autoit. I know you will think: "What is this old guy talking about, I want to code NOW!" - but believe me, a little time spent in understanding at the beginning is well worth it. Your blood pressure wil remain at a more reasonable level, you will not need to pepper your posts with undiplomatic language (yes, we had noticed ;) ), and you will become a better coder in the end. There are excellent tutorials here and here and even video tutorials on YouTube if you prefer watching to reading.

And finally, DO NOT send PMs asking for help - it is considered extremely rude here (and interrupted me while I was writing this reply which is why I bring it up in open forum :evil: ).

Now, if you have a script which joins together these functions into something which actually runs - please post it and I will see how we can implement a "Back" button. If not, then please go and study the tutorials and write one. :)

I am very happy to help you , but I am not doing all the work for you - you need to do your part as well. :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

well, i'm having lots of trouble. contrary to popular belief, i actually do remember the answers.

this script, is infact being executed from a master script. but all the masterscript does is call this script.

but the masterscript only calls GUIPKAN().

i've already been through some times where an unrelated to the function problem caused a problem.

this script is simply a collections of GUIs for the masterscript. one of them isn't working.

due to fact i'm going to be submitting this thing on a japanese learning forum, i copied all the files from the autoit include folder to @scriptdir\Data\Include, hence the #include "Include\whatever" part.

also, since i copied the files from the include folder, i manually went through most of them to change all the #include <> to #include "", which may explain why there was no need for ButtonConstants to be included.

i understand where you're coming from about the tutorials, but i prefer the poke-it-with-a-stick method, which i use an excuse for the ton of questions i'm flooding the forum with.

as for the pm, i didn't know it's considered rude here and i apologize. i'm stumbling on alot of tiny stupid issues with my code (example, the tinyass window thread)

and while i try to beat my code into submission, i'm posting my issue here in case someone knows a better solution then i can come up with. this is also a reason i'm sometimes looking for another friend coder here. most of my solutions are not as elegant as someone else would purpose. biggest example would be adding a $a=$b somewhere in one of my oldest drunk-written scripts. while it works, i would like for it to make some SENSE for the sober self.

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

i try to beat my code into submission

I rest my case.

That is NOT the way to approach coding. All that will do is give you difficult-to-maintain code which will cause even more problems in the long run. You need to understand WHY thing are happening, not just what code will perform the trick in a particular case.

Now, to your "Back" button. Just remove the ExitLoops from your Case structures - it is those commands that are ending the function by exiting the While...WEnd loop. But you will need to add another button which DOES have an ExitLoop in its Case structure to be able to exit at some point. Does that make sense? ;)

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

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