Jump to content

Cant see my GUI


Rapid
 Share

Recommended Posts

Hi guys, I made a program and I used KODA to create a gui, 

I'm not really sure how to make it so when the program launches, it will show the gui...

I've included the GUI au3 but cant manage to make it work :(.

 

Any help?

Link to comment
Share on other sites

Well what do I need to include to make the GUI run?

How do u initialize a GUI to work?

Should I include the Main files from the GUI file or is it ok include the GUI from the Main program file?

 

It's a program I rather keep private at the moment, when i'm done ill probably release it.

 

Link to comment
Share on other sites

Look at the help file for GUICreate, make sure you use GUISetState in your code.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

Rapid,

Then post a short script which just includes the GUI creation section of your main script - without any code from you we are just guessing.

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 <Functions\GUI.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <ImageSearch.au3>
#include <GUIConstants.au3>
; Script Start - Add your code below here
GUISetState(@SW_SHOW)
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F2}", "StartProg")
Global Const $sLogFile = 'log.txt'
Global $hFileOpen = FileOpen($sLogFile, $FO_APPEND)


Func Start()
If $hFileOpen = -1 Then
        MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.")
        Return False
EndIf
EndFunc

Func StartProg()
While(1)
    ;Initialize()

    Start()
    Sleep(1000)
WEnd
EndFunc




Func Terminate()
    Exit 0
EndFunc

this is the main file just for the test

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Test", 260, 90, 635, 316)
$Combo1 = GUICtrlCreateCombo("", 96, 8, 65, 25)
GUICtrlSetData($Combo1, "250|300")
GUICtrlSetFont($Combo1, 10, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Start", 8, 56, 75, 25)
$Label1 = GUICtrlCreateLabel("User Search", 3, 8, 90, 20)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case 250
        $UserSet = 250
        Case 300
        $UserSet = 300
    EndSwitch
WEnd

that's the GUI file and this is the main script file

Link to comment
Share on other sites

  • Moderators

Rapid,

The GUI displays fine for me - I have adjusted the code so that you will correctly set the $UserSet variable when using the combo:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Local $UserSet = "Not Set"

$Form1 = GUICreate("Test", 260, 90, 635, 316)
$Combo1 = GUICtrlCreateCombo("", 96, 8, 65, 25)
GUICtrlSetData($Combo1, "250|300")
GUICtrlSetFont($Combo1, 10, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Start", 8, 56, 75, 25)
$Label1 = GUICtrlCreateLabel("User Search", 3, 8, 90, 20)
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg

        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            Switch GUICtrlRead($Combo1)
                Case 250
                    $UserSet = 250
                Case 300
                    $UserSet = 300
            EndSwitch

        Case $Button1
            MsgBox($MB_SYSTEMMODAL, "Selected", $UserSet)
    EndSwitch
WEnd

Now how is this GUI supposed to fit into the first script?

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, first the GUI opens, then nothing happens, when the user clicks "start" then it starts the other script.

But the problem is the main script, just wont open the GUI.

I know the GUI itself will open, but I want to compile the other script and make it open the GUI. 

Link to comment
Share on other sites

  • Moderators

Rapid,

I think I understand - does this do what you want?

#include <GUIConstantsEx.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

HotKeySet("{ESC}", "Terminate")
HotKeySet("{F2}", "StartProg")

Global Const $sLogFile = 'log.txt'
Global $UserSet = "Not Set"

While 1
    Sleep(10)
WEnd



Func StartProg()

    $Form1 = GUICreate("Test", 260, 90, 635, 316)
    $Combo1 = GUICtrlCreateCombo("", 96, 8, 65, 25)
    GUICtrlSetData($Combo1, "250|300")
    GUICtrlSetFont($Combo1, 10, 800, 0, "MS Sans Serif")
    $Button1 = GUICtrlCreateButton("Start", 8, 56, 75, 25)
    $Label1 = GUICtrlCreateLabel("User Search", 3, 8, 90, 20)
    GUISetState(@SW_SHOW)

    While 1
        $Msg = GUIGetMsg()
        Switch $Msg

            Case $GUI_EVENT_CLOSE
                Exit
            Case $Combo1
                Switch GUICtrlRead($Combo1)
                    Case 250
                        $UserSet = 250
                    Case 300
                        $UserSet = 300
                EndSwitch

            Case $Button1
                $bReturn = Start()
                ; $bReturn will be True/False depending on what the function returned
        EndSwitch

    WEnd



EndFunc



Func Start()
    Local $hFileOpen = FileOpen($sLogFile, $FO_APPEND)
    If $hFileOpen = -1 Then
        MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.")
        Return False
    Else
        ; Do what you need here
         MsgBox($MB_SYSTEMMODAL, "", "Now doing something.")
        FileClose($hFileOpen)
        Return True
    EndIf

EndFunc



Func Terminate()
    Exit 0
EndFunc

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

Yes, you got it, but I wanted to do it from a different file not to overload my main file and make it easy to read. 

It's not possible to set my GUI in a different file? and just call it from my main file to load?

Link to comment
Share on other sites

  • Moderators

Rapid,

You can indeed put the GUI code in a different file and call it from your main script, but I would argue that this is less efficient that keeping all the code in the same script. If you are worried about having too many lines of code in the script and navigation becoming difficult then take a look at the #region keyword - you can find details in the "SciTE4AutoIt3 - Lexer feature" page within the SciTE4AutoIt3 help file. Using that you can keep large scripts under control.

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

Rapid,

Glad I could help.

As you can see from the above, we are pretty quick at responding when you post here., so I see no reason to do more than that.

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