Husker_Jason

Update Button availability based on other window data

3 posts in this topic

#1 ·  Posted

I'm trying to use a number of window elements to determine when a button is active or inactive.  Three of the elements are whether I have a file loaded and a fourth is either automatically loaded from a file or manually entered if a radio button has been activated.  I only want my Process button to be active when all the conditions have been met.  I also want to check the input box for activity and update the button any time that data has been changed.

I've tried a number of ways to do this, but haven't found an nice way to do all the above.  Right now I'm checking the data in the main loop, but now the Process button just flickers.  I've tried to use the GUIRegisterMsg tricks I've seen, but to be honest, I don't completely understand how that works.  The only way I can see to make it work in my case is to set up a number of Global Variables so it can check status in the function.

Anyway, if anyone could help me out, I'd greatly appreciate it.  Here is the basic code I have stripped down.  I've also attached three sample files so people can test.

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <Misc.au3>                                                 ; for _Singleton command
#include <EditConstants.au3>                                        ; for $ES_NUMBER
#include <StaticConstants.au3>                                      ; for $SS_RIGHT
#include <GuiRichEdit.au3>                                          ; for Text Rich
#include <WindowsConstants.au3>                                     ; for Text Rich
#include <FileConstants.au3>                                        ; System Modal Dialogs
#include <File.au3>                                                 ; File Utilites
#include <ProgressConstants.au3>                                    ; Progress Bar
#include <Constants.au3>                                            ; Save styles
#include <WinAPI.au3>                                               ; Save styles
#include <GuiButton.au3>                                            ; Button controls


Opt('MustDeclareVars', 1)                                           ; Forces programmer to initialize variables

; Declare the name of the program
Global $vsProgramName="Test Strip Yield Extractor"                  ; Name of Program
_Singleton($vsProgramName)                                          ; Only allow one occurance of this program to Run

; Declare Local Variables

; Button Handles
Local $hbExit                                                       ; Exit the Program
Local $hbLoadSampleSet1                                             ; Load Data from Sample set 1
Local $hbLoadSampleSet2                                             ; Load Data from Sample set 2
Local $hbLoadPlotSet                                                ; Load Data from Plot locations to sample
Local $hbProcessData                                                ; Process the information

; Window Label Values
Local $hlFile1                                                      ; File name of File 1
Local $hlFile2                                                      ; File name of File 2
Local $hlFile3                                                      ; File name of Points list
Local $hlPoints1                                                    ; Total points in File 1
Local $hlPoints2                                                    ; Total points in File 2
Local $hlPoints3                                                    ; Total Sample Points
Local $hlSampDist                                                   ; Sample Distance
Local $hpbProgressBar                                               ; Progress Bar
Local $hlProgressBar                                                ; Progress Bar Text
Local $hlSamplePoints                                               ; Message for sample points
Local $hrbPoints                                                    ; Radio Button to use Manually selected points
Local $hrAutoPoints                                                 ; Radio Button to use Automatically generated points along a line

; Save Style infor for GUI components
Local $iStylePoints3                                                ; Style for Points3 dialog
Local $hlPoints3_Handle                                             ; Handle to store data

; File Handles
Local $hfSavePoints                                                 ; File with points
Local $hfSaveStats                                                  ; File with Statistics

; Declare Main program GUI variables
Local $wMainWin                                                     ; Handle of Window main GUI
Local $mFileMenu                                                    ; Handle of Menu File
Local $msExitItem                                                   ; Handle of SubMenu Exit in File
Local $mHelpMenu                                                    ; Handle of Menu Help
Local $msVersion                                                    ; Handle of SubMenu Version in Help
Local $Msg                                                          ; Variable handling GUI Control
                                                                    ; Initial Directory to start with
Local $vsIniDir=@MyDocumentsDir


; Start the program
_Main()

Func _Main()
    ; Create GUI
    $wMainWin = GUICreate($vsProgramName, 600, 600)

    ; Create Buttons and Check Boxes
    $hbLoadSampleSet1 = GUICtrlCreateButton("Load Data" & @CR & "Data Set 1", 70, 30, 70, 70, $BS_MULTILINE)
    $hbLoadSampleSet2 = GUICtrlCreateButton("Load Data" & @CR & "Data Set 2", 70, 145, 70, 70, $BS_MULTILINE)
    $hbLoadPlotSet = GUICtrlCreateButton("Load Plot" & @CR & "Points", 70, 260, 70, 70, $BS_MULTILINE)
    $hbProcessData = GUICtrlCreateButton("Proces" & @CR & "Data", 70, 375, 70, 70, $BS_MULTILINE)
    $hbExit = GUICtrlCreateButton("Exit", 440, 540, 120, 25)

    ; Create frames around sections
    GUICtrlCreateLabel ("", 0, 0, 600, 2, $SS_ETCHEDFRAME)
    GUICtrlCreateLabel ("", 0, 115, 600, 2, $SS_ETCHEDFRAME)
    GUICtrlCreateLabel ("", 0, 230, 600, 2, $SS_ETCHEDFRAME)
    GUICtrlCreateLabel ("", 0, 345, 600, 2, $SS_ETCHEDFRAME)

    ; Create Labels on window
    GUICtrlCreateLabel ("Data Set 1 Information:", 15, 8)
    GUICtrlCreateLabel ("Data Set 2 Information:", 15, 123)
    GUICtrlCreateLabel ("Sample Location Information:", 15, 238)
    GUICtrlCreateLabel ("Process Data:", 15, 353)
    GUICtrlCreateLabel ("File Name:", 160, 32)
    GUICtrlCreateLabel ("File Name:", 160, 147)
    GUICtrlCreateLabel ("File Name:", 160, 262)
    GUICtrlCreateLabel ("Total Points in File:", 160, 62)
    GUICtrlCreateLabel ("Total Points in File:", 160, 177)
    $hlSamplePoints = GUICtrlCreateLabel ("Total Points in File:", 160, 318, 180, 20)
    GUICtrlCreateLabel ("Sample Radius:", 160, 380)
    GUICtrlCreateLabel ("Feet", 315, 380)

    ; Create Data Boxes
    $hlFile1 = GUICtrlCreateInput ("*** Please Select a File ***", 215, 29, 380, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
    $hlFile2 = GUICtrlCreateInput ("*** Please Select a File ***", 215, 144, 380, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
    $hlFile3 = GUICtrlCreateInput ("*** Please Select a File ***", 215, 259, 380, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
    $hlPoints1 = GUICtrlCreateInput ("Empty", 255, 59, 100, 20, $ES_READONLY)
    $hlPoints2 = GUICtrlCreateInput ("Empty", 255, 174, 100, 20, $ES_READONLY)
    $hlPoints3 = GUICtrlCreateInput ("Empty", 335, 316, 100, 20)
    $hlPoints3_Handle = GUICtrlGetHandle($hlPoints3)
    $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Style
    GUICtrlSetStyle($hlPoints3, BitOR($iStylePoints3, $ES_READONLY, $ES_NUMBER)); Add Read Only Style
    $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Updated Style
    $hlSampDist = GUICtrlCreateInput ("", 255, 377, 50, 20)

    ; Create Radio Buttons
    Local $hrbPoints = GUICtrlCreateRadio("Manual Points", 160, 292, 100, 20)
    Local $hrAutoPoints = GUICtrlCreateRadio("Auto Points", 260, 292, 100, 20)

    ; Create Progress Bar
    $hlProgressBar = GUICtrlCreateLabel ("", 380, 463, 200 , 20)
    $hpbProgressBar = GUICtrlCreateProgress(70, 460 , 300 , 20 , $PBS_SMOOTH)

    ; Declare Program Variables
    Local $ErrArray                                                 ; Error opening Array
    Local $vsFileName1                                              ; File Name of File1
    Local $vsFileName2                                              ; File Name of File2
    Local $vsFileName3                                              ; File Name of File3
    Local $vsSavePoints                                             ; File Name of Saved Points
    Local $vsSavePath                                               ; Path to Save Points
    Local $vsSaveStats                                              ; File Name of Saved Statistics
    Local $vaFileData1                                              ; Data Array for File 1
    Local $vaFileData2                                              ; Data Array for File 2
    Local $vaFileData3                                              ; Data Array for File 3
    Local $X                                                        ; Loop Counter
    Local $Y                                                        ; Loop Counter2
    Local $vaLatLong[4]                                             ; Array to hold [0]Ref Lat, [1]Ref Long, [2]Convert Lat, and [3]Convert Long for conversion
    Local $vaUTM[3]                                                 ; Array to hold [0]UTM Zone, [1]UTM North, and [2]UTM South from conversion
    Local $viSampDist=90                                            ; Distance to find yield data from sample point
    Local $vaResults[1][4]                                          ; Results

    ; Create File Menus and Lists
    $mFileMenu = GUICtrlCreateMenu("File")
    $msExitItem = GUICtrlCreateMenuItem("Exit", $mFileMenu)

    ; Set Control Status
    GUICtrlSetState($hrbPoints, $GUI_CHECKED)
    GUICtrlSetState($hbProcessData, $GUI_DISABLE)
    GUICtrlSetData($hlSampDist, $viSampDist)

    ; Set Windows Control Command
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

    ; Show the GUICreate
    GUISetState(@SW_SHOW)

    While 1
        $Msg = GUIGetMsg()

        If (GUICtrlRead($hlPoints3)) > 1 and $vsFileName1 <> "" And $vsFileName2 <> "" And $vsFileName3 <> "" Then
            GUICtrlSetState($hbProcessData, $GUI_ENABLE)
        Else                                                                            ; At least one file hasn't been set
            GUICtrlSetState($hbProcessData, $GUI_DISABLE)
        EndIf

        Select
            Case $Msg = $hbExit                                     ; Pressed the close button
                _AreYouSure()

            Case $Msg = $GUI_EVENT_CLOSE                            ; Corner X pressed
                _AreYouSure()

            Case $Msg = $msExitItem                                 ; Exit chosen from the Main Menu
                _AreYouSure()

            Case $Msg = $hrbPoints                                  ; Manual Points has been selected
                GUICtrlSetData($hlSamplePoints, "Total Points in File:")
                GUICtrlSetData($hlFile3, "*** Please Select a File ***")
                GUICtrlSetStyle($hlPoints3, BitOR($iStylePoints3, $ES_READONLY)); Add Read Only Style
                $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Updated Style
                GUICtrlSetData($hlPoints3, "Empty")
                $vsFileName3 = ""
                GUICtrlSetState($hbProcessData, $GUI_DISABLE)

            Case $Msg = $hrAutoPoints                               ; Auto generate Points has been selected
                GUICtrlSetData($hlSamplePoints, "How many sample pairs required?")
                GUICtrlSetData($hlFile3, "*** Please Select a File ***")
                if $iStylePoints3 = "1342253184" Then GUICtrlSetStyle($hlPoints3, BitXOR($iStylePoints3, $ES_READONLY)); Add Read Only Style only if the style is the right one from before
                $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Updated Style
                GUICtrlSetData($hlPoints3, "** Enter Points **")
                $vsFileName3 = ""
                GUICtrlSetState($hbProcessData, $GUI_DISABLE)
                GuiCtrlSetState($hlPoints3, $GUI_FOCUS)

            Case $Msg = $hbLoadSampleSet1                           ; Load Yield Data from File 1
                $vsFileName1 = FileOpenDialog ( "Open Data Set 1", $vsIniDir, "CSV Files (*.csv;*.txt)|All Files (*.*)", 3, "", $wMainWin)
                $ErrArray = _FileReadToArray($vsFileName1, $vaFileData1, Default, ",")

                ; Set data and status of text and buttons
                If $vsFileName1 <> "" Then                                                      ; We have data
                    GUICtrlSetData($hlFile1, $vsFileName1)                                      ; Set the file name window
                    GUICtrlSetData($hlPoints1, $vaFileData1[0][0])                              ; Set number of records window
                Else                                                                            ; We don't have data
                    GUICtrlSetData($hlFile1, "*** Please Select a File ***")                    ; Reset file name window
                    GUICtrlSetData($hlPoints1, "Empty")                                         ; Reset number of records window
                EndIf

            Case $Msg = $hbLoadSampleSet2                           ; Load Yield Data from File 2
                $vsFileName2 = FileOpenDialog ( "Open Data Set 2", $vsIniDir, "CSV Files (*.csv;*.txt)|All Files (*.*)", 3, "", $wMainWin)
                $ErrArray = _FileReadToArray($vsFileName2, $vaFileData2, Default, ",")

                If $vsFileName2 <> "" Then                                                      ; We have data
                    GUICtrlSetData($hlFile2, $vsFileName2)                                      ; Set the file name window
                    GUICtrlSetData($hlPoints2, $vaFileData2[0][0])                              ; Set number of records window
                Else                                                                            ; We don't have data
                    GUICtrlSetData($hlFile2, "*** Please Select a File ***")                    ; Reset file name window
                    GUICtrlSetData($hlPoints2, "Empty")                                         ; Reset number of records window
                EndIf

            Case $Msg = $hbLoadPlotSet                              ; Load Test Locations
                $vsFileName3 = FileOpenDialog ( "Sample Location Data Set", $vsIniDir, "CSV Files (*.csv;*.txt)|All Files (*.*)", 3, "", $wMainWin)
                $ErrArray = _FileReadToArray($vsFileName3, $vaFileData3, Default, ",")
                ; Set data and status of text and buttons
                If $vsFileName3 <> "" Then                                                      ; We have data
                    GUICtrlSetData($hlFile3, $vsFileName3)                                      ; Set the file name window
                    If _GUICtrlButton_GetState($hrbPoints) = $BST_CHECKED Then                  ; Only set points if Manual Points selected
                        ConsoleWrite("Got to Button Check")
                        GUICtrlSetData($hlPoints3, $vaFileData3[0][0])                          ; Set number of records window
                    EndIf
                Else                                                                            ; We don't have data
                    GUICtrlSetData($hlFile3, "*** Please Select a File ***")                    ; Reset file name window
                    GUICtrlSetData($hlPoints3, "Empty")                                         ; Reset number of records window
                EndIf

            Case $Msg = $hbProcessData                                                          ; Process the Files

                ; Determine File Names for Save
                $vsSavePath = StringLeft($vsFileName1,StringInStr($vsFileName1,"\", $STR_NOCASESENSE, -1))
                $vsSavePoints = StringRight($vsFileName1, (StringLen($vsFileName1) - StringInStr($vsFileName1,"\", $STR_NOCASESENSE, -1))) & "_" & StringRight($vsFileName2, (StringLen($vsFileName2) - StringInStr($vsFileName2,"\", $STR_NOCASESENSE, -1))) & "_Points.csv"
                $vsSaveStats = StringRight($vsFileName1, (StringLen($vsFileName1) - StringInStr($vsFileName1,"\", $STR_NOCASESENSE, -1))) & "_" & StringRight($vsFileName2, (StringLen($vsFileName2) - StringInStr($vsFileName2,"\", $STR_NOCASESENSE, -1))) & "_Stats.csv"

        EndSelect
    Wend
EndFunc

Func _AreYouSure()                                      ; Check if we want to close program
;   $MsgBoxAns = MsgBox(36, "Close Program", "Do you wish to Close this program?", 0, $wMainWin)
;       If $MsgBoxAns = 6 Then                          ; Yes was pressed
            Exit
;       EndIf
EndFunc

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $IdFrom, $iCode

    $IdFrom = BitAnd($wParam, 0x0000FFFF)
    $iCode = BitShift($wParam, 16)

    Switch $IdFrom
        Case $hlPoints3
            Switch $iCode
                Case $EN_UPDATE
;                   If (GUICtrlRead($hlPoints3)) > 1 and $vsFileName1 <> "" And $vsFileName2 <> "" And $vsFileName3 <> "" Then
;                       GUICtrlSetState($hbProcessData, $GUI_ENABLE)
;                   Else                                                                            ; At least one file hasn't been set
;                       GUICtrlSetState($hbProcessData, $GUI_DISABLE)
;                   EndIf
                    ConsoleWrite("!> Changes on edit control detected" & @LF)
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc

 

Lance.csv

No Lance.csv

SamplePoints.csv

Share this post


Link to post
Share on other sites



#2 ·  Posted

Well, I think I solved my own problem after looking at things a little differently.  I created a function that returns enable or disable button after I send the function the value of the variables I want shown below

Func _CheckButtonStatus($hlPoints3, $vsFileName1, $vsFileName2, $vsFileName3)
    If StringIsDigit(GUICtrlRead($hlPoints3)) = 1 and $vsFileName1 <> "" And $vsFileName2 <> "" And $vsFileName3 <> "" Then
        Return $GUI_ENABLE                              ; All Info filled out
    Else
        Return $GUI_DISABLE                             ; At least one piece of data not ready
    EndIf
EndFunc

Then after each button or radio dial that is pushed I call this function to test

GUICtrlSetState($hbProcessData, _CheckButtonStatus($hlPoints3, $vsFileName1, $vsFileName2, $vsFileName3))  ; Check if ready to enable button

I use the Text Change function I found on line provided by Rasim in Example shown below.  I made a slight modification to change the flag for a global variable to tell the main program if the data has changed in the text box.  I'm not sure how this works, as I am referring to a Local variable $hlPoints3 which is not referenced in this function (it is in the main program).  From what I understand, it should error on me when it tries to use the variable.  If anyone can explain to me why this works, I would greatly appreciate it.

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $IdFrom, $iCode

    $IdFrom = BitAnd($wParam, 0x0000FFFF)
    $iCode = BitShift($wParam, 16)

    Switch $IdFrom
        Case $hlPoints3
            Switch $iCode
                Case $EN_UPDATE
                    $viTextChanged = 1
            EndSwitch
    EndSwitch

I then added this last check in the loop to only run if the detect data change flag has been changed

If $viTextChanged = 1 Then                                  ; Check to see if text has changed in the input box
            GUICtrlSetState($hbProcessData, _CheckButtonStatus($hlPoints3, $vsFileName1, $vsFileName2, $vsFileName3))  ; Check if ready to enable button
            $viTextChanged = 0
        EndIf

With these changes I was able to get the button to enable or disable depending on the conditions.  If anyone has a more elegant way to accomplish this, I'm open to suggestions.

The complete code fixed is below for anyone that ones to use/try

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <Misc.au3>                                                 ; for _Singleton command
#include <EditConstants.au3>                                        ; for $ES_NUMBER
#include <StaticConstants.au3>                                      ; for $SS_RIGHT
#include <GuiRichEdit.au3>                                          ; for Text Rich
#include <WindowsConstants.au3>                                     ; for Text Rich
#include <FileConstants.au3>                                        ; System Modal Dialogs
#include <File.au3>                                                 ; File Utilites
#include <ProgressConstants.au3>                                    ; Progress Bar
#include <Constants.au3>                                            ; Save styles
#include <WinAPI.au3>                                               ; Save styles
#include <GuiButton.au3>                                            ; Button controls


Opt('MustDeclareVars', 1)                                           ; Forces programmer to initialize variables

; Declare the name of the program
Global $vsProgramName="Test Strip Yield Extractor"                  ; Name of Program
Global $viTextChanged                                               ; Global Variable detecting change of text in input box

_Singleton($vsProgramName)                                          ; Only allow one occurance of this program to Run

; Declare Local Variables

; Button Handles
Local $hbExit                                                       ; Exit the Program
Local $hbLoadSampleSet1                                             ; Load Data from Sample set 1
Local $hbLoadSampleSet2                                             ; Load Data from Sample set 2
Local $hbLoadPlotSet                                                ; Load Data from Plot locations to sample
Local $hbProcessData                                                ; Process the information

; Window Label Values
Local $hlFile1                                                      ; File name of File 1
Local $hlFile2                                                      ; File name of File 2
Local $hlFile3                                                      ; File name of Points list
Local $hlPoints1                                                    ; Total points in File 1
Local $hlPoints2                                                    ; Total points in File 2
Local $hlPoints3                                                    ; Total Sample Points
Local $hlSampDist                                                   ; Sample Distance
Local $hpbProgressBar                                               ; Progress Bar
Local $hlProgressBar                                                ; Progress Bar Text
Local $hlSamplePoints                                               ; Message for sample points
Local $hrbPoints                                                    ; Radio Button to use Manually selected points
Local $hrAutoPoints                                                 ; Radio Button to use Automatically generated points along a line

; Save Style infor for GUI components
Local $iStylePoints3                                                ; Style for Points3 dialog
Local $hlPoints3_Handle                                             ; Handle to store data

; File Handles
Local $hfSavePoints                                                 ; File with points
Local $hfSaveStats                                                  ; File with Statistics

; Declare Main program GUI variables
Local $wMainWin                                                     ; Handle of Window main GUI
Local $mFileMenu                                                    ; Handle of Menu File
Local $msExitItem                                                   ; Handle of SubMenu Exit in File
Local $mHelpMenu                                                    ; Handle of Menu Help
Local $msVersion                                                    ; Handle of SubMenu Version in Help
Local $Msg                                                          ; Variable handling GUI Control
                                                                    ; Initial Directory to start with
Local $vsIniDir=@MyDocumentsDir & "\Customer Data\Agri-Data\Justin Cleaver\JVC\QGIS\Regaux\"


; Start the program
_Main()

Func _Main()
    ; Create GUI
    $wMainWin = GUICreate($vsProgramName, 600, 600)

    ; Create Buttons and Check Boxes
    $hbLoadSampleSet1 = GUICtrlCreateButton("Load Data" & @CR & "Data Set 1", 70, 30, 70, 70, $BS_MULTILINE)
    $hbLoadSampleSet2 = GUICtrlCreateButton("Load Data" & @CR & "Data Set 2", 70, 145, 70, 70, $BS_MULTILINE)
    $hbLoadPlotSet = GUICtrlCreateButton("Load Plot" & @CR & "Points", 70, 260, 70, 70, $BS_MULTILINE)
    $hbProcessData = GUICtrlCreateButton("Proces" & @CR & "Data", 70, 375, 70, 70, $BS_MULTILINE)
    $hbExit = GUICtrlCreateButton("Exit", 440, 540, 120, 25)

    ; Create frames around sections
    GUICtrlCreateLabel ("", 0, 0, 600, 2, $SS_ETCHEDFRAME)
    GUICtrlCreateLabel ("", 0, 115, 600, 2, $SS_ETCHEDFRAME)
    GUICtrlCreateLabel ("", 0, 230, 600, 2, $SS_ETCHEDFRAME)
    GUICtrlCreateLabel ("", 0, 345, 600, 2, $SS_ETCHEDFRAME)

    ; Create Labels on window
    GUICtrlCreateLabel ("Data Set 1 Information:", 15, 8)
    GUICtrlCreateLabel ("Data Set 2 Information:", 15, 123)
    GUICtrlCreateLabel ("Sample Location Information:", 15, 238)
    GUICtrlCreateLabel ("Process Data:", 15, 353)
    GUICtrlCreateLabel ("File Name:", 160, 32)
    GUICtrlCreateLabel ("File Name:", 160, 147)
    GUICtrlCreateLabel ("File Name:", 160, 262)
    GUICtrlCreateLabel ("Total Points in File:", 160, 62)
    GUICtrlCreateLabel ("Total Points in File:", 160, 177)
    $hlSamplePoints = GUICtrlCreateLabel ("Total Points in File:", 160, 318, 180, 20)
    GUICtrlCreateLabel ("Sample Radius:", 160, 380)
    GUICtrlCreateLabel ("Feet", 315, 380)

    ; Create Data Boxes
    $hlFile1 = GUICtrlCreateInput ("*** Please Select a File ***", 215, 29, 380, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
    $hlFile2 = GUICtrlCreateInput ("*** Please Select a File ***", 215, 144, 380, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
    $hlFile3 = GUICtrlCreateInput ("*** Please Select a File ***", 215, 259, 380, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
    $hlPoints1 = GUICtrlCreateInput ("Empty", 255, 59, 100, 20, $ES_READONLY)
    $hlPoints2 = GUICtrlCreateInput ("Empty", 255, 174, 100, 20, $ES_READONLY)
    $hlPoints3 = GUICtrlCreateInput ("Empty", 335, 316, 100, 20)
    $hlPoints3_Handle = GUICtrlGetHandle($hlPoints3)
    $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Style
    GUICtrlSetStyle($hlPoints3, BitOR($iStylePoints3, $ES_READONLY, $ES_NUMBER)); Add Read Only Style
    $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Updated Style
    $hlSampDist = GUICtrlCreateInput ("", 255, 377, 50, 20)

    ; Create Radio Buttons
    Local $hrbPoints = GUICtrlCreateRadio("Manual Points", 160, 292, 100, 20)
    Local $hrAutoPoints = GUICtrlCreateRadio("Auto Points", 260, 292, 100, 20)

    ; Create Progress Bar
    $hlProgressBar = GUICtrlCreateLabel ("", 380, 463, 200 , 20)
    $hpbProgressBar = GUICtrlCreateProgress(70, 460 , 300 , 20 , $PBS_SMOOTH)

    ; Declare Program Variables
    Local $ErrArray                                                 ; Error opening Array
    Local $vsFileName1                                              ; File Name of File1
    Local $vsFileName2                                              ; File Name of File2
    Local $vsFileName3                                              ; File Name of File3
    Local $vsSavePoints                                             ; File Name of Saved Points
    Local $vsSavePath                                               ; Path to Save Points
    Local $vsSaveStats                                              ; File Name of Saved Statistics
    Local $vaFileData1                                              ; Data Array for File 1
    Local $vaFileData2                                              ; Data Array for File 2
    Local $vaFileData3                                              ; Data Array for File 3
    Local $X                                                        ; Loop Counter
    Local $Y                                                        ; Loop Counter2
    Local $vaLatLong[4]                                             ; Array to hold [0]Ref Lat, [1]Ref Long, [2]Convert Lat, and [3]Convert Long for conversion
    Local $vaUTM[3]                                                 ; Array to hold [0]UTM Zone, [1]UTM North, and [2]UTM South from conversion
    Local $viSampDist=90                                            ; Distance to find yield data from sample point
    Local $vaResults[1][4]                                          ; Results

    ; Create File Menus and Lists
    $mFileMenu = GUICtrlCreateMenu("File")
    $msExitItem = GUICtrlCreateMenuItem("Exit", $mFileMenu)

    ; Set Control Status
    GUICtrlSetState($hrbPoints, $GUI_CHECKED)
    GUICtrlSetState($hbProcessData, $GUI_DISABLE)
    GUICtrlSetData($hlSampDist, $viSampDist)

    ; Set Windows Control Command
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

    ; Show the GUICreate
    GUISetState(@SW_SHOW)

    While 1
        $Msg = GUIGetMsg()

        If $viTextChanged = 1 Then                                  ; Check to see if text has changed in the input box
            GUICtrlSetState($hbProcessData, _CheckButtonStatus($hlPoints3, $vsFileName1, $vsFileName2, $vsFileName3))  ; Check if ready to enable button
            $viTextChanged = 0
        EndIf

        Select
            Case $Msg = $hbExit                                     ; Pressed the close button
                _AreYouSure()

            Case $Msg = $GUI_EVENT_CLOSE                            ; Corner X pressed
                _AreYouSure()

            Case $Msg = $msExitItem                                 ; Exit chosen from the Main Menu
                _AreYouSure()

            Case $Msg = $hrbPoints                                  ; Manual Points has been selected
                GUICtrlSetData($hlSamplePoints, "Total Points in File:")
                GUICtrlSetData($hlFile3, "*** Please Select a File ***")
                GUICtrlSetStyle($hlPoints3, BitOR($iStylePoints3, $ES_READONLY)); Add Read Only Style
                $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Updated Style
                GUICtrlSetData($hlPoints3, "Empty")
                $vsFileName3 = ""
                GUICtrlSetState($hbProcessData, _CheckButtonStatus($hlPoints3, $vsFileName1, $vsFileName2, $vsFileName3))  ; Check if ready to enable button

            Case $Msg = $hrAutoPoints                               ; Auto generate Points has been selected
                GUICtrlSetData($hlSamplePoints, "How many sample pairs required?")
                GUICtrlSetData($hlFile3, "*** Please Select a File ***")
                if $iStylePoints3 = "1342253184" Then GUICtrlSetStyle($hlPoints3, BitXOR($iStylePoints3, $ES_READONLY)); Add Read Only Style only if the style is the right one from before
                $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Updated Style
                GUICtrlSetData($hlPoints3, "** Enter Points **")
                $vsFileName3 = ""
                GUICtrlSetState($hbProcessData, _CheckButtonStatus($hlPoints3, $vsFileName1, $vsFileName2, $vsFileName3))  ; Check if ready to enable button
                GuiCtrlSetState($hlPoints3, $GUI_FOCUS)

            Case $Msg = $hbLoadSampleSet1                           ; Load Yield Data from File 1
                $vsFileName1 = FileOpenDialog ( "Open Data Set 1", $vsIniDir, "CSV Files (*.csv;*.txt)|All Files (*.*)", 3, "", $wMainWin)
                $ErrArray = _FileReadToArray($vsFileName1, $vaFileData1, Default, ",")

                ; Set data and status of text and buttons
                If $vsFileName1 <> "" Then                                                      ; We have data
                    GUICtrlSetData($hlFile1, $vsFileName1)                                      ; Set the file name window
                    GUICtrlSetData($hlPoints1, $vaFileData1[0][0])                              ; Set number of records window
                Else                                                                            ; We don't have data
                    GUICtrlSetData($hlFile1, "*** Please Select a File ***")                    ; Reset file name window
                    GUICtrlSetData($hlPoints1, "Empty")                                         ; Reset number of records window
                EndIf
                GUICtrlSetState($hbProcessData, _CheckButtonStatus($hlPoints3, $vsFileName1, $vsFileName2, $vsFileName3))  ; Check if ready to enable button

            Case $Msg = $hbLoadSampleSet2                           ; Load Yield Data from File 2
                $vsFileName2 = FileOpenDialog ( "Open Data Set 2", $vsIniDir, "CSV Files (*.csv;*.txt)|All Files (*.*)", 3, "", $wMainWin)
                $ErrArray = _FileReadToArray($vsFileName2, $vaFileData2, Default, ",")

                If $vsFileName2 <> "" Then                                                      ; We have data
                    GUICtrlSetData($hlFile2, $vsFileName2)                                      ; Set the file name window
                    GUICtrlSetData($hlPoints2, $vaFileData2[0][0])                              ; Set number of records window
                Else                                                                            ; We don't have data
                    GUICtrlSetData($hlFile2, "*** Please Select a File ***")                    ; Reset file name window
                    GUICtrlSetData($hlPoints2, "Empty")                                         ; Reset number of records window
                EndIf
                GUICtrlSetState($hbProcessData, _CheckButtonStatus($hlPoints3, $vsFileName1, $vsFileName2, $vsFileName3))  ; Check if ready to enable button

            Case $Msg = $hbLoadPlotSet                              ; Load Test Locations
                $vsFileName3 = FileOpenDialog ( "Sample Location Data Set", $vsIniDir, "CSV Files (*.csv;*.txt)|All Files (*.*)", 3, "", $wMainWin)
                $ErrArray = _FileReadToArray($vsFileName3, $vaFileData3, Default, ",")
                ; Set data and status of text and buttons
                If $vsFileName3 <> "" Then                                                      ; We have data
                    GUICtrlSetData($hlFile3, $vsFileName3)                                      ; Set the file name window
                    If _GUICtrlButton_GetState($hrbPoints) = $BST_CHECKED Then                  ; Only set points if Manual Points selected
                        ConsoleWrite("Got to Button Check")
                        GUICtrlSetData($hlPoints3, $vaFileData3[0][0])                          ; Set number of records window
                    EndIf
                Else                                                                            ; We don't have data
                    GUICtrlSetData($hlFile3, "*** Please Select a File ***")                    ; Reset file name window
                    GUICtrlSetData($hlPoints3, "Empty")                                         ; Reset number of records window
                EndIf
                GUICtrlSetState($hbProcessData, _CheckButtonStatus($hlPoints3, $vsFileName1, $vsFileName2, $vsFileName3))  ; Check if ready to enable button

            Case $Msg = $hbProcessData                                                          ; Process the Files

                ; Determine File Names for Save
                $vsSavePath = StringLeft($vsFileName1,StringInStr($vsFileName1,"\", $STR_NOCASESENSE, -1))
                $vsSavePoints = StringRight($vsFileName1, (StringLen($vsFileName1) - StringInStr($vsFileName1,"\", $STR_NOCASESENSE, -1))) & "_" & StringRight($vsFileName2, (StringLen($vsFileName2) - StringInStr($vsFileName2,"\", $STR_NOCASESENSE, -1))) & "_Points.csv"
                $vsSaveStats = StringRight($vsFileName1, (StringLen($vsFileName1) - StringInStr($vsFileName1,"\", $STR_NOCASESENSE, -1))) & "_" & StringRight($vsFileName2, (StringLen($vsFileName2) - StringInStr($vsFileName2,"\", $STR_NOCASESENSE, -1))) & "_Stats.csv"

        EndSelect
    Wend
EndFunc

Func _AreYouSure()                                      ; Check if we want to close program
;   $MsgBoxAns = MsgBox(36, "Close Program", "Do you wish to Close this program?", 0, $wMainWin)
;       If $MsgBoxAns = 6 Then                          ; Yes was pressed
            Exit
;       EndIf
EndFunc

Func _CheckButtonStatus($hlPoints3, $vsFileName1, $vsFileName2, $vsFileName3)
    If StringIsDigit(GUICtrlRead($hlPoints3)) = 1 and $vsFileName1 <> "" And $vsFileName2 <> "" And $vsFileName3 <> "" Then
        Return $GUI_ENABLE                              ; All Info filled out
    Else
        Return $GUI_DISABLE                             ; At least one piece of data not ready
    EndIf
EndFunc

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $IdFrom, $iCode

    $IdFrom = BitAnd($wParam, 0x0000FFFF)
    $iCode = BitShift($wParam, 16)

    Switch $IdFrom
        Case $hlPoints3
            Switch $iCode
                Case $EN_UPDATE
                    $viTextChanged = 1
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

Another way:

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <Misc.au3>                                                 ; for _Singleton command
#include <EditConstants.au3>                                        ; for $ES_NUMBER
#include <StaticConstants.au3>                                      ; for $SS_RIGHT
#include <GuiRichEdit.au3>                                          ; for Text Rich
#include <WindowsConstants.au3>                                     ; for Text Rich
#include <FileConstants.au3>                                        ; System Modal Dialogs
#include <File.au3>                                                 ; File Utilites
#include <ProgressConstants.au3>                                    ; Progress Bar
#include <Constants.au3>                                            ; Save styles
#include <WinAPI.au3>                                               ; Save styles
#include <GuiButton.au3>                                            ; Button controls


Opt('MustDeclareVars', 1)                                           ; Forces programmer to initialize variables

; Declare the name of the program
Global $vsProgramName="Test Strip Yield Extractor"                  ; Name of Program
Global $viTextChanged                                               ; Global Variable detecting change of text in input box

_Singleton($vsProgramName)                                          ; Only allow one occurance of this program to Run

; Declare Local Variables

; Button Handles
Local $hbExit                                                       ; Exit the Program
Local $hbLoadSampleSet1                                             ; Load Data from Sample set 1
Local $hbLoadSampleSet2                                             ; Load Data from Sample set 2
Local $hbLoadPlotSet                                                ; Load Data from Plot locations to sample
Local $hbProcessData                                                ; Process the information

; Window Label Values
Local $hlFile1                                                      ; File name of File 1
Local $hlFile2                                                      ; File name of File 2
Local $hlFile3                                                      ; File name of Points list
Local $hlPoints1                                                    ; Total points in File 1
Local $hlPoints2                                                    ; Total points in File 2
Local $hlPoints3                                                    ; Total Sample Points
Local $hlSampDist                                                   ; Sample Distance
Local $hpbProgressBar                                               ; Progress Bar
Local $hlProgressBar                                                ; Progress Bar Text
Local $hlSamplePoints                                               ; Message for sample points
Local $hrbPoints                                                    ; Radio Button to use Manually selected points
Local $hrAutoPoints                                                 ; Radio Button to use Automatically generated points along a line

; Save Style infor for GUI components
Local $iStylePoints3                                                ; Style for Points3 dialog
Local $hlPoints3_Handle                                             ; Handle to store data

; File Handles
Global $vsFileName1                                              ; File Name of File1
Global $vsFileName2                                              ; File Name of File2
Global $vsFileName3                                              ; File Name of File3
Local $hfSavePoints                                                 ; File with points
Local $hfSaveStats                                                  ; File with Statistics

; Declare Main program GUI variables
Local $wMainWin                                                     ; Handle of Window main GUI
Local $mFileMenu                                                    ; Handle of Menu File
Local $msExitItem                                                   ; Handle of SubMenu Exit in File
Local $mHelpMenu                                                    ; Handle of Menu Help
Local $msVersion                                                    ; Handle of SubMenu Version in Help
Local $Msg                                                          ; Variable handling GUI Control
                                                                    ; Initial Directory to start with
Local $vsIniDir=@MyDocumentsDir & "\Customer Data\Agri-Data\Justin Cleaver\JVC\QGIS\Regaux\"


; Start the program
_Main()

Func _Main()
    ; Create GUI
    $wMainWin = GUICreate($vsProgramName, 600, 600)

    ; Create Buttons and Check Boxes
    $hbLoadSampleSet1 = GUICtrlCreateButton("Load Data" & @CR & "Data Set 1", 70, 30, 70, 70, $BS_MULTILINE)
    $hbLoadSampleSet2 = GUICtrlCreateButton("Load Data" & @CR & "Data Set 2", 70, 145, 70, 70, $BS_MULTILINE)
    $hbLoadPlotSet = GUICtrlCreateButton("Load Plot" & @CR & "Points", 70, 260, 70, 70, $BS_MULTILINE)
    $hbProcessData = GUICtrlCreateButton("Proces" & @CR & "Data", 70, 375, 70, 70, $BS_MULTILINE)
    $hbExit = GUICtrlCreateButton("Exit", 440, 540, 120, 25)

    ; Create frames around sections
    GUICtrlCreateLabel ("", 0, 0, 600, 2, $SS_ETCHEDFRAME)
    GUICtrlCreateLabel ("", 0, 115, 600, 2, $SS_ETCHEDFRAME)
    GUICtrlCreateLabel ("", 0, 230, 600, 2, $SS_ETCHEDFRAME)
    GUICtrlCreateLabel ("", 0, 345, 600, 2, $SS_ETCHEDFRAME)

    ; Create Labels on window
    GUICtrlCreateLabel ("Data Set 1 Information:", 15, 8)
    GUICtrlCreateLabel ("Data Set 2 Information:", 15, 123)
    GUICtrlCreateLabel ("Sample Location Information:", 15, 238)
    GUICtrlCreateLabel ("Process Data:", 15, 353)
    GUICtrlCreateLabel ("File Name:", 160, 32)
    GUICtrlCreateLabel ("File Name:", 160, 147)
    GUICtrlCreateLabel ("File Name:", 160, 262)
    GUICtrlCreateLabel ("Total Points in File:", 160, 62)
    GUICtrlCreateLabel ("Total Points in File:", 160, 177)
    $hlSamplePoints = GUICtrlCreateLabel ("Total Points in File:", 160, 318, 180, 20)
    GUICtrlCreateLabel ("Sample Radius:", 160, 380)
    GUICtrlCreateLabel ("Feet", 315, 380)

    ; Create Data Boxes
    $hlFile1 = GUICtrlCreateInput ("*** Please Select a File ***", 215, 29, 380, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
    $hlFile2 = GUICtrlCreateInput ("*** Please Select a File ***", 215, 144, 380, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
    $hlFile3 = GUICtrlCreateInput ("*** Please Select a File ***", 215, 259, 380, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
    $hlPoints1 = GUICtrlCreateInput ("Empty", 255, 59, 100, 20, $ES_READONLY)
    $hlPoints2 = GUICtrlCreateInput ("Empty", 255, 174, 100, 20, $ES_READONLY)
    $hlPoints3 = GUICtrlCreateInput ("Empty", 335, 316, 100, 20)
    $hlPoints3_Handle = GUICtrlGetHandle($hlPoints3)
    $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Style
    GUICtrlSetStyle($hlPoints3, BitOR($iStylePoints3, $ES_READONLY, $ES_NUMBER)); Add Read Only Style
    $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Updated Style
    $hlSampDist = GUICtrlCreateInput ("", 255, 377, 50, 20)

    ; Create Radio Buttons
    Local $hrbPoints = GUICtrlCreateRadio("Manual Points", 160, 292, 100, 20)
    Local $hrAutoPoints = GUICtrlCreateRadio("Auto Points", 260, 292, 100, 20)

    ; Create Progress Bar
    $hlProgressBar = GUICtrlCreateLabel ("", 380, 463, 200 , 20)
    $hpbProgressBar = GUICtrlCreateProgress(70, 460 , 300 , 20 , $PBS_SMOOTH)

    ; Declare Program Variables
    Local $ErrArray                                                 ; Error opening Array
    Local $vsSavePoints                                             ; File Name of Saved Points
    Local $vsSavePath                                               ; Path to Save Points
    Local $vsSaveStats                                              ; File Name of Saved Statistics
    Local $vaFileData1                                              ; Data Array for File 1
    Local $vaFileData2                                              ; Data Array for File 2
    Local $vaFileData3                                              ; Data Array for File 3
    Local $X                                                        ; Loop Counter
    Local $Y                                                        ; Loop Counter2
    Local $vaLatLong[4]                                             ; Array to hold [0]Ref Lat, [1]Ref Long, [2]Convert Lat, and [3]Convert Long for conversion
    Local $vaUTM[3]                                                 ; Array to hold [0]UTM Zone, [1]UTM North, and [2]UTM South from conversion
    Local $viSampDist=90                                            ; Distance to find yield data from sample point
    Local $vaResults[1][4]                                          ; Results

    ; Create File Menus and Lists
    $mFileMenu = GUICtrlCreateMenu("File")
    $msExitItem = GUICtrlCreateMenuItem("Exit", $mFileMenu)

    ; Set Control Status
    GUICtrlSetState($hrbPoints, $GUI_CHECKED)
    GUICtrlSetState($hbProcessData, $GUI_DISABLE)
    GUICtrlSetData($hlSampDist, $viSampDist)

    ; Show the GUICreate
    GUISetState(@SW_SHOW)
    AdlibRegister("_CheckButtonStatus")
    While 1
        $Msg = GUIGetMsg()

        Select
            Case $Msg = $hbExit                                     ; Pressed the close button
                _AreYouSure()

            Case $Msg = $GUI_EVENT_CLOSE                            ; Corner X pressed
                _AreYouSure()

            Case $Msg = $msExitItem                                 ; Exit chosen from the Main Menu
                _AreYouSure()

            Case $Msg = $hrbPoints                                  ; Manual Points has been selected
                GUICtrlSetData($hlSamplePoints, "Total Points in File:")
                GUICtrlSetData($hlFile3, "*** Please Select a File ***")
                GUICtrlSetStyle($hlPoints3, BitOR($iStylePoints3, $ES_READONLY)); Add Read Only Style
                $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Updated Style
                GUICtrlSetData($hlPoints3, "Empty")
                $vsFileName3 = ""

            Case $Msg = $hrAutoPoints                               ; Auto generate Points has been selected
                GUICtrlSetData($hlSamplePoints, "How many sample pairs required?")
                GUICtrlSetData($hlFile3, "*** Please Select a File ***")
                if $iStylePoints3 = "1342253184" Then GUICtrlSetStyle($hlPoints3, BitXOR($iStylePoints3, $ES_READONLY)); Add Read Only Style only if the style is the right one from before
                $iStylePoints3 = _WinAPI_GetWindowLong($hlPoints3_Handle, $GWL_STYLE)   ; Store Updated Style
                GUICtrlSetData($hlPoints3, "** Enter Points **")
                $vsFileName3 = ""
                GuiCtrlSetState($hlPoints3, $GUI_FOCUS)

            Case $Msg = $hbLoadSampleSet1                           ; Load Yield Data from File 1
                $vsFileName1 = FileOpenDialog ( "Open Data Set 1", $vsIniDir, "CSV Files (*.csv;*.txt)|All Files (*.*)", 3, "", $wMainWin)
                $ErrArray = _FileReadToArray($vsFileName1, $vaFileData1, Default, ",")

                ; Set data and status of text and buttons
                If $vsFileName1 <> "" Then                                                      ; We have data
                    GUICtrlSetData($hlFile1, $vsFileName1)                                      ; Set the file name window
                    GUICtrlSetData($hlPoints1, $vaFileData1[0][0])                              ; Set number of records window
                Else                                                                            ; We don't have data
                    GUICtrlSetData($hlFile1, "*** Please Select a File ***")                    ; Reset file name window
                    GUICtrlSetData($hlPoints1, "Empty")                                         ; Reset number of records window
                EndIf

            Case $Msg = $hbLoadSampleSet2                           ; Load Yield Data from File 2
                $vsFileName2 = FileOpenDialog ( "Open Data Set 2", $vsIniDir, "CSV Files (*.csv;*.txt)|All Files (*.*)", 3, "", $wMainWin)
                $ErrArray = _FileReadToArray($vsFileName2, $vaFileData2, Default, ",")

                If $vsFileName2 <> "" Then                                                      ; We have data
                    GUICtrlSetData($hlFile2, $vsFileName2)                                      ; Set the file name window
                    GUICtrlSetData($hlPoints2, $vaFileData2[0][0])                              ; Set number of records window
                Else                                                                            ; We don't have data
                    GUICtrlSetData($hlFile2, "*** Please Select a File ***")                    ; Reset file name window
                    GUICtrlSetData($hlPoints2, "Empty")                                         ; Reset number of records window
                EndIf

            Case $Msg = $hbLoadPlotSet                              ; Load Test Locations
                $vsFileName3 = FileOpenDialog ( "Sample Location Data Set", $vsIniDir, "CSV Files (*.csv;*.txt)|All Files (*.*)", 3, "", $wMainWin)
                $ErrArray = _FileReadToArray($vsFileName3, $vaFileData3, Default, ",")
                ; Set data and status of text and buttons
                If $vsFileName3 <> "" Then                                                      ; We have data
                    GUICtrlSetData($hlFile3, $vsFileName3)                                      ; Set the file name window
                    If _GUICtrlButton_GetState($hrbPoints) = $BST_CHECKED Then                  ; Only set points if Manual Points selected
                        ConsoleWrite("Got to Button Check")
                        GUICtrlSetData($hlPoints3, $vaFileData3[0][0])                          ; Set number of records window
                    EndIf
                Else                                                                            ; We don't have data
                    GUICtrlSetData($hlFile3, "*** Please Select a File ***")                    ; Reset file name window
                    GUICtrlSetData($hlPoints3, "Empty")                                         ; Reset number of records window
                EndIf

            Case $Msg = $hbProcessData                                                          ; Process the Files

                ; Determine File Names for Save
                $vsSavePath = StringLeft($vsFileName1,StringInStr($vsFileName1,"\", $STR_NOCASESENSE, -1))
                $vsSavePoints = StringRight($vsFileName1, (StringLen($vsFileName1) - StringInStr($vsFileName1,"\", $STR_NOCASESENSE, -1))) & "_" & StringRight($vsFileName2, (StringLen($vsFileName2) - StringInStr($vsFileName2,"\", $STR_NOCASESENSE, -1))) & "_Points.csv"
                $vsSaveStats = StringRight($vsFileName1, (StringLen($vsFileName1) - StringInStr($vsFileName1,"\", $STR_NOCASESENSE, -1))) & "_" & StringRight($vsFileName2, (StringLen($vsFileName2) - StringInStr($vsFileName2,"\", $STR_NOCASESENSE, -1))) & "_Stats.csv"

        EndSelect
    Wend
EndFunc

Func _AreYouSure()                                      ; Check if we want to close program
;   $MsgBoxAns = MsgBox(36, "Close Program", "Do you wish to Close this program?", 0, $wMainWin)
;       If $MsgBoxAns = 6 Then                          ; Yes was pressed
            Exit
;       EndIf
EndFunc

Func _CheckButtonStatus()
    If Number(GUICtrlRead($hlPoints3)) > 0 And FileExists($vsFileName1) And FileExists($vsFileName2) And FileExists($vsFileName3) Then
        If BitAND(GUICtrlGetState($hbProcessData), $GUI_DISABLE) = $GUI_DISABLE Then GUICtrlSetState($hbProcessData, $GUI_ENABLE)
    Else
        If BitAND(GUICtrlGetState($hbProcessData), $GUI_ENABLE) = $GUI_ENABLE Then GUICtrlSetState($hbProcessData, $GUI_DISABLE)
    EndIf
EndFunc

 

Share this post


Link to post
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