Ambient Posted December 23, 2009 Share Posted December 23, 2009 Hi folks, I am trying to create an ini editor for work purposes. I have a GUI which has a context menu built on the fly from ini sections. When I click on the menu it it then passes the section name to a function that uses $text=IniReadSection ( $g_IniFile, $section ). This then puts the section keys into the editbox $edit1 using $Edit1 = GUICtrlCreateEdit("",30,70,600,300,BitOR($ES_NOHIDESEL,$ES_AUTOVSCROLL, $WS_HSCROLL,$WS_VSCROLL, $ES_MULTILINE)) GUICtrlSetData ($Edit1 ,_readsection($sText)) The problem is this, before running GUICtrlSetData ($Edit1 ,_readsection($sText)) I run a clear function which essentially does this GUICtrlSetData ($Edit1 ,"") which clears the text OK from $edit1 If I then rightclick and bring up my selecting another section it puts it into the editbox but it is appended to the section text that was there previously. AHs anayone got any ideas where I'mgoing wrong. I have searched for 2 days in forum but can't see any thing releavant. I a have also tried in clear the following: $rs=GUICtrlSetData($Edit1 , "","") sleep(2000) If $rs=1 Then msgbox(0,$rs, "Success") Else msgbox(0,$rs, "Failure") Endif this returns 1 Also tried _GUICtrlEdit_SetText($edit1,"") and GUICtrlSendMsg($Edit1 , $WM_SETTEXT, 0, "") No joy either , thanks in advance for your suggestions.Also , any ideas how I can save edited text to the file. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 23, 2009 Moderators Share Posted December 23, 2009 Ambient,The code you have tried should work, as you can see here:#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> $sText = "Just for a start" $sText2 = "And now for something completely different" $hGUI = GUICreate("Test", 500, 500) $hButton = GUICtrlCreateButton("Change", 10, 10, 80, 30) $hEdit1 = GUICtrlCreateEdit("", 10, 50, 480, 300, BitOR($ES_NOHIDESEL, $ES_AUTOVSCROLL, $WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE)) GUISetState() GUICtrlSetData($hEdit1, $sText) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton GUICtrlSetData($hEdit1, $sText2) EndSwitch WEndSo I am tempted to suspect the problem is in the function that sends the text to the GUICtrlSetData command - _readsection. Have you looked at what it is returning - perhaps a quick ConsoleWrite or MsgBox as it returns might pay dividends! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Ambient Posted December 23, 2009 Author Share Posted December 23, 2009 I suspect you may be right did a quick consolewrite and it looks like it is returning duplicate key names? However only showing one in Editbox. Anyway haven't time today to look at it further . Thank you very much for your suggestion. I'll keep you posted. Link to comment Share on other sites More sharing options...
mini Posted December 23, 2009 Share Posted December 23, 2009 Hello, M23. Is it possible to use a $Edit box, to display the content of a .INI file. Imagine, that you have a .INI file in your documents folder, and you want to edit it, but using one $EDIT box, sow you have to read the .INI file in to the $Edit Box, and if you made any change of the text that is on the $Edit box, you can save it. Do you think that's possible? Thanks in advance. [size="4"]My first work[/size], it checks if one prograrm is running and if not it closes all necessery windows and run them again.[size="4"]My second work[/size], Script Function: It saves a Client Info and creates a INI file for all clients with all the info.[size="4"]My third work[/size], Script Function: It change some INFO on a working program, every X min configured. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 23, 2009 Moderators Share Posted December 23, 2009 mini,Please do not hijack threads - it is considered rude here! But yes, you can do what you ask very easily. Look at FileRead and FileWrite in the Help file.If you want more help, start a new topic! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mini Posted December 23, 2009 Share Posted December 23, 2009 mini,Please do not hijack threads - it is considered rude here! But yes, you can do what you ask very easily. Look at FileRead and FileWrite in the Help file.If you want more help, start a new topic! M23Sorry Ambient for using your thread....Thx for the advise M23 [size="4"]My first work[/size], it checks if one prograrm is running and if not it closes all necessery windows and run them again.[size="4"]My second work[/size], Script Function: It saves a Client Info and creates a INI file for all clients with all the info.[size="4"]My third work[/size], Script Function: It change some INFO on a working program, every X min configured. Link to comment Share on other sites More sharing options...
Ambient Posted December 24, 2009 Author Share Posted December 24, 2009 Hi got this one sorted now working as I would like except the part where I do the editing saving etc.Mini you are forgiven its the season of "goodwill to all men" (oh and women of course) after all lol!Thanks a bunch Melba23 your suggestion worked it was that function. I was initializing a variable outside the function to clear the editbox mived this into the function to clear before updating and now working a treat. All I have to do now is work out how to do the rest of this lol! Have a great Christmas and Thanks again. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 24, 2009 Moderators Share Posted December 24, 2009 Ambient, Glad I could help! Merry Xmas! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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