Jump to content

GUISetHelp Placement


mr-es335
 Share

Go to solution Solved by ioa747,

Recommended Posts

Good day,

In the following sample, where is the preferred placement of the GUISetHelp Function? And, may I also "Why" is this placement preferred?

; -----------------------------------------------
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Global $hGUI = GUICreate("Title", 220, 75)
; -----------------------------------------------
; COLUMN 1 BUTTONS
Global $_sCol1Row1 = GUICtrlCreateButton("Item 1", 10, 10, 200, 25)
Global $_sCol1Row2 = GUICtrlCreateButton("Item 1", 10, 40, 200, 25)
; -----------------------------------------------
GUISetState(@SW_SHOW, $hGUI)
; -----------------------------------------------
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
            ; -----------------
            ; COLUMN 1 BUTTONS
        Case $_sCol1Row1
            _MyFunction1()
        Case $_sCol1Row2
            _MyFunction2()
    EndSwitch
WEnd
; -----------------------------------------------
; COLUMN 1 BUTTONS
; -----------------------------------------------
Func _MyFunction1()
    MsgBox(0, "", "Inside _MyFunction1")
EndFunc   ;==>_MyFunction1
; -----------------------------------------------
Func _MyFunction2()
        MsgBox(0, "", "Inside _MyFunction2")
EndFunc   ;==>_MyFunction2
; -----------------------------------------------

Here is the GUISetHelp Function:

; -----------------------------------------------
Func _UserDocs()
    Local $sPdfProgram = "C:\Program Files (x86)\FoxitReader\Foxit Reader.exe"
    Local $sPdfFile = "C:\Working\TestMe.pdf"
    ; -----------------------------------------------
    GUISetHelp('"' & $sPdfProgram & '" "' &  $sPdfFile & '"')
EndFunc   ;==>_UserDocs
; -----------------------------------------------

I have attached a test pdf as well.

As always, any clarification would be greatly appreciated!

TestMe.pdf

Edited by mr-es335
Link to comment
Share on other sites

I placed it immediately after the appearance of the gui,
because that seemed to me the most appropriate position
(it could have been included earlier)

;~  -----------------------------------------------
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Global $hGUI = GUICreate("Title", 220, 75)
; -----------------------------------------------
; COLUMN 1 BUTTONS
Global $_sCol1Row1 = GUICtrlCreateButton("Item 1", 10, 10, 200, 25)
Global $_sCol1Row2 = GUICtrlCreateButton("Item 1", 10, 40, 200, 25)
; -----------------------------------------------
GUISetState(@SW_SHOW, $hGUI)
_UserDocs()
; -----------------------------------------------
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
            ; -----------------
            ; COLUMN 1 BUTTONS
        Case $_sCol1Row1
            _MyFunction1()
        Case $_sCol1Row2
            _MyFunction2()
    EndSwitch
WEnd
; -----------------------------------------------
; COLUMN 1 BUTTONS
; -----------------------------------------------
Func _MyFunction1()
    MsgBox(0, "", "Inside _MyFunction1")
EndFunc   ;==>_MyFunction1
; -----------------------------------------------
Func _MyFunction2()
        MsgBox(0, "", "Inside _MyFunction2")
EndFunc   ;==>_MyFunction2
; -----------------------------------------------
Func _UserDocs()
    Local $sPdfProgram = "C:\Program Files (x86)\FoxitReader\Foxit Reader.exe"
    Local $sPdfFile = "C:\Working\TestMe.pdf"
    ; -----------------------------------------------
    GUISetHelp('"' & $sPdfProgram & '" "' &  $sPdfFile & '"')
EndFunc   ;==>_UserDocs
; -----------------------------------------------

 

I know that I know nothing

Link to comment
Share on other sites

  • Solution

or you could take this approach, where things have their place :)

;~  -----------------------------------------------
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Global $hGUI = GUICreate("Title", 220, 75)
; -----------------------------------------------
; COLUMN 1 BUTTONS
Global $_sCol1Row1 = GUICtrlCreateButton("Item 1", 10, 10, 200, 25)
Global $_sCol1Row2 = GUICtrlCreateButton("Item 1", 10, 40, 200, 25)
Global $idUserDocs = GUICtrlCreateDummy()
; -----------------------------------------------
Local $aAccelKeys[1][2] = [["{F1}", $idUserDocs]]
GUISetAccelerators($aAccelKeys)
; -----------------------------------------------
GUISetState(@SW_SHOW, $hGUI)
; -----------------------------------------------
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
            ; -----------------
            ; COLUMN 1 BUTTONS
        Case $_sCol1Row1
            _MyFunction1()
        Case $_sCol1Row2
            _MyFunction2()
        Case $idUserDocs
            _UserDocs()
    EndSwitch
WEnd
; -----------------------------------------------
; COLUMN 1 BUTTONS
; -----------------------------------------------
Func _MyFunction1()
    MsgBox(0, "", "Inside _MyFunction1")
EndFunc   ;==>_MyFunction1
; -----------------------------------------------
Func _MyFunction2()
    MsgBox(0, "", "Inside _MyFunction2")
EndFunc   ;==>_MyFunction2
; -----------------------------------------------
Func _UserDocs()
    Local $sPdfProgram = "C:\Program Files (x86)\FoxitReader\Foxit Reader.exe"
    Local $sPdfFile = "C:\Working\TestMe.pdf"
    ; -----------------------------------------------
    ShellExecute($sPdfProgram, $sPdfFile)
EndFunc   ;==>_UserDocs
; -----------------------------------------------

 

I know that I know nothing

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