Jump to content

GuiCtrlCreateInput not changing when I try to chang it [Solved]


norjms
 Share

Recommended Posts

I'm having trouble with a Input box. I created it just fine and it populates properly when there is no data or there is data. The problem is later on when I try to change the value the text box doesn't change.

;File System Broswer for Target Path
$BrowseFileSystem = GUICtrlCreateButton("Browse", 280, 232, 75, 25, $WS_GROUP)
Local $BrowseFileSystemSelect = IniRead($Configure,"DVD Rip Output Path","Key", "Default")
    ;setting up for blank info
        If $BrowseFileSystemSelect = "" Then 
                $RipTargetPath = GUICtrlCreateInput("...", 16, 232, 257, 21)
    ;setting up for populated info
        Else
        $RipTargetPath = GUICtrlCreateInput($BrowseFileSystemSelect, 16, 232, 257, 21)
    EndIf

Here is where I call the changes but nothing happens as it doesn't redraw or change the text box above

Case $nMsg = $BrowseFileSystem
                $BrowseSelect = FileSelectFolder("Select the folder/drive where you want the DVD Rips stored.", "")
                IniWrite($Configure,"DVD Rip Output Path","Key",$BrowseSelect)
                Local $RipTargetPath = GUICtrlCreateInput($BrowseFileSystemSelect, 16, 232, 257, 21)

Thanks for taking a look.

Edited by norjms
Link to comment
Share on other sites

  • Moderators

norjms,

Do not recreate your input to change the text - just use GUICtrlSetData to change the text within the existing control. But read the Helpfile carefully as to how to format the data or you will just add to the text already there. :)

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

I must be missing something....

;File System Broswer for Target Path
$BrowseFileSystem = GUICtrlCreateButton("Browse", 280, 232, 75, 25, $WS_GROUP)
Local $BrowseFileSystemSelect = IniRead($Configure,"DVD Rip Output Path","Key", "Default")
    If $BrowseFileSystemSelect = "" Then
        $RipTargetPath = GUICtrlCreateInput("...", 16, 232, 257, 21)
    Else
        $RipTargetPath = GUICtrlCreateInput($BrowseFileSystemSelect, 16, 232, 257, 21)
    EndIf

Changed to GuiCtrlSetData

Case $nMsg = $BrowseFileSystem
                $BrowseSelect = FileSelectFolder("Select the folder/drive where you want the DVD Rips stored.", "")
                IniWrite($Configure,"DVD Rip Output Path","Key",$BrowseSelect)
                Local $BrowseFileSystemSelect = IniRead($Configure,"DVD Rip Output Path","Key", "Default")
                $RipTargetPath = GUICtrlSetData($BrowseFileSystemSelect,$RipTargetPath)

No idea here I'm quite new at this

Link to comment
Share on other sites

  • Moderators

norjms,

Looks like you have the syntax a little wrong:

$RipTargetPath = GUICtrlSetData($BrowseFileSystemSelect,$RipTargetPath)

$RipTargetPath is the ControlID returned when you created the Input control - you use that to identify the control to other commands.

When you look at GUICtrlSetData in the Helpfile you find the following syntax:

GUICtrlSetData ( controlID, data [, default] )

You need to put $RipTargetPath as the ControlID (so AutoIt knows where to put the data!) and then whatever you need as data. You can ignore the final parameter as it only affects Combo and List controls.

So I would imagine your seocnd snippet should read:

Case $nMsg = $BrowseFileSystem
    ; Get the folder to use
    $BrowseSelect = FileSelectFolder("Select the folder/drive where you want the DVD Rips stored.", "")
    ; Save it to the ini file
    IniWrite($Configure,"DVD Rip Output Path","Key",$BrowseSelect)
    ; Change the input box text
    GUICtrlSetData($RipTargetPath, $BrowseSelect) ; Note syntax
    ; Not sure if you need this line, it depends on whether you want this variable set to the new  folder
    Local $BrowseFileSystemSelect = $BrowseSelect

    ; But there is certainly no point in re-reading the value from the ini file!!!
    ; Local $BrowseFileSystemSelect = IniRead($Configure,"DVD Rip Output Path","Key", "Default")

I hope this helps. If anything is unclear, please ask. If you need more help, it might be better to post a bit more code - trying to work off 2 small snippets is a bit limiting! :)

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

Thank You it worked great last question would I use the same method for guictrlcreatepic? Trying to use little leds to show what options are enabled. i.e create the the gui portion then add the guictrlsetdata to the case strings?

Link to comment
Share on other sites

  • Moderators

norjms,

From the Help file for GUICtrlCreatePic:

"To update the picture after the dialog box is displayed just use GUICtrlSetImage"

It is a wonderful resource, you know! :)

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