mr-es335 Posted yesterday at 04:10 PM Share Posted yesterday at 04:10 PM (edited) Good day, In the following sample, where is the preferred placement of the GUISetHelp Function? And, may I also "Why" is this placement preferred? expandcollapse popup; ----------------------------------------------- #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 yesterday at 04:30 PM by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
ioa747 Posted yesterday at 05:03 PM Share Posted yesterday at 05:03 PM 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) expandcollapse popup;~ ----------------------------------------------- #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 ; ----------------------------------------------- mr-es335 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Solution ioa747 Posted yesterday at 05:17 PM Solution Share Posted yesterday at 05:17 PM or you could take this approach, where things have their place expandcollapse popup;~ ----------------------------------------------- #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 ; ----------------------------------------------- mr-es335 1 I know that I know nothing Link to comment Share on other sites More sharing options...
mr-es335 Posted yesterday at 05:49 PM Author Share Posted yesterday at 05:49 PM ioa747, The second example looks to be more appropriate! Thanks again! Much appreciated! ioa747 1 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now