Jump to content

Gui storing erroneous values


Dlund
 Share

Recommended Posts

Hey all, I'm working on a script to read in values and write them to an array which increases with size as values are added from a GUI three at a time.

at this time, I have the following script.
 

#include <GUIConstantsEx.au3>
#include <Array.au3>
main()

Func saveData($arr, $newData)

    If IsArray($arr) = 1 Then
        $Bound = UBound($arr)
        ReDim $arr[$Bound+1]
        $arr[$Bound] = $newData
    Else
        Dim $arr[1]
        $arr[0] = $newData
     EndIf
;    _ArrayDisplay($arr)
   Return $arr
  EndFunc



Func main()
   dim $arr1;
   $oForm1 = GUICreate("Form1", 623, 226, 192, 114)
   $Input1 = GUICtrlCreateInput("X Value", 8, 8, 177, 21)
   $Input2 = GUICtrlCreateInput("Y Value", 264, 8, 129, 21)
   $Input3 = GUICtrlCreateInput("Z Value", 496, 8, 121, 21)

   $Button1 = GUICtrlCreateButton("Save and Continue", 8, 187, 137, 16)
   $Button2 = GUICtrlCreateButton("Save and Print", 152, 187, 145, 16)
   $Button3 = GUICtrlCreateButton("Cancel and Print", 304, 187, 137, 16)

   GUISetState(@SW_SHOW)

   While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $Button1
                  $arr1 = saveData($arr1, $Input1)
                  $arr1 = saveData($arr1, $Input2)
                  $arr1 = saveData($arr1, $Input3);
                                  GUICtrlSetData($Input1, "Newer X")
                  GUICtrlSetData($Input2, "Newer Y")
                  GUICtrlSetData($Input3, "Newer Z")
               Case $Button2
                  $arr1 = saveData($arr1, $Input1)
                  $arr1 = saveData($arr1, $Input2)
                  $arr1 = saveData($arr1, $Input3);
                  _ArrayDisplay($arr1)
                  Exit
        Case $Button3
           _ArrayDisplay($arr1)
            Exit
    EndSwitch
WEnd
EndFunc

The array successfully increases in size, but when called in the groups of three it is always storing the values: 3,4, and then 5.  Even if the default text is left as is 

Edited by Dlund
Link to comment
Share on other sites

  • Moderators

Dlund,

Answer my question in your other thread and I might answer this one - seems a fair deal to me. ;)

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

Dlund,

And as this appears to relate to the same script as the one in your other recently locked thread, this gets locked too. :naughty:

M23

P.S. But to show we are not all bad - look at GUICtrlRead in the Help file. You are storing the ControlID, not the data within the control. ;)

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

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...