Lope Posted April 26, 2010 Posted April 26, 2010 (edited) I need an Input Control that's Read only, white background, black text, with Scrolling. When I try use $ES_READONLY it goes grey and forces it to be single line... $ES_MULTILINE+$WS_VSCROLL looks good, but I need read only behaviour. I've looked in the help & searched the forums, can't find anything... Edited April 27, 2010 by Lope
Moderators Melba23 Posted April 26, 2010 Moderators Posted April 26, 2010 (edited) Lope,First a question: What is the use of a Read-Only Input? An Input control is designed to be written in!Secondly, an Input is by definition a single line Edit control, so it is not surprising you are running into problems when you try to scroll down. What exactly are you trying to do? Perhaps we can offer another solution. M23Edit: Typnig again........ Edited April 26, 2010 by Melba23 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
Fire Posted April 26, 2010 Posted April 26, 2010 Lope IMHO you need ComboBox not input .If i understand correct your question... #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #Region ### START Koda GUI section ### Form=Form1.kxf $Form1 = GUICreate("Form1", 633, 264, 192, 124) $Combo1 = GUICtrlCreateCombo("", 176, 112, 265, 25, BitOR($WS_VSCROLL,$ES_READONLY,$CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetBkColor(-1,0xFFFFFF) ;white background color For $i=1 to 100 GUICtrlSetData($Combo1,$i & "|" ) Next GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd [size="5"] [/size]
Lope Posted April 26, 2010 Author Posted April 26, 2010 (edited) Thanks for the replies. I'm doing a license agreement box in my program. The user needs to be able to read all the text, scrolling down as they read through it, then click a box saying 'I accept the terms' etc. See attachment. I've got it working, but I need it to be read only behaviour. When I set read only it goes grey and single line... Any suggestions, like on right click, or on keypress it just overwrites the textbox with a variable again? GUICtrlCreateInput("blah" & @CRLF & "blah etc",$offsetx_content,$offsety_content+50,$width_contentarea,$height_contentarea-50,$ES_MULTILINE+$WS_VSCROLL) ;I'm trying to find out when the user clicks the control, or types in it, because then I can overwrite it with the original text... While 1 switch GUIGetMsg() case $myinputhandle ;can't get this to fire... msgbox (0,"foo","bar") EndSwitch WEnd Edited April 26, 2010 by Lope
Makaule Posted April 27, 2010 Posted April 27, 2010 (edited) As Melba already told, Input is SingleLine Edit Box, thats why you cant input multiline data in input box by default. My advice would be try to use GUICtrlCreateEdit. Its same as GUICtrlCreateInput, just it would create Edit Box, which would allow to enter multiline data by default. For changing grey to white, you may simple use GUICtrlSetBkColor([Edit box],0xFFFFFF).For the last question you may try HotKeySet. If you want to use any buttom from your soft, you could use either the way with GUIGetMsg, either GUIOnEventMode. For me GUIOnEventMode way looks better, so its what i am using.By the way, dont know how about others, but i am too lazy to write a code just for testing what you want, so it would be good if you add just a part of script which i could compile and test what you get. Edited April 27, 2010 by Makaule
Moderators Melba23 Posted April 27, 2010 Moderators Posted April 27, 2010 Lope,Now we know what you want......: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> ; Generate long text $sText = "blah" & @CRLF For $i = 1 To 7 $sText &= $sText Next ; Create GUI $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel("Agree or else!", 10, 10, 200, 20) GUICtrlCreateEdit($sText, 10, 40, 480, 200, BitOr($WS_VSCROLL, $ES_READONLY)) $hButton = GUICtrlCreateButton("Close", 210, 460, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hButton Exit EndSwitch WEndNote you have to use BitOr to combine the styles. If you use a particular style, you overwrite any existing styles, so you must make sure you include all those you require. And why BitOR? Because most of the styles are set at a the bit level (look at the values in the Help file) and merely adding the values risks setting bits you do not want. Ask if anything is unclear. 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
olympus Posted April 27, 2010 Posted April 27, 2010 Lope, Now we know what you want......: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> ; Generate long text $sText = "blah" & @CRLF For $i = 1 To 7 $sText &= $sText Next ; Create GUI $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel("Agree or else!", 10, 10, 200, 20) GUICtrlCreateEdit($sText, 10, 40, 480, 200, BitOr($WS_VSCROLL, $ES_READONLY)) $hButton = GUICtrlCreateButton("Close", 210, 460, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hButton Exit EndSwitch WEnd Note you have to use BitOr to combine the styles. If you use a particular style, you overwrite any existing styles, so you must make sure you include all those you require. And why BitOR? Because most of the styles are set at a the bit level (look at the values in the Help file) and merely adding the values risks setting bits you do not want. Ask if anything is unclear. M23 Excellent! I wanted to start another thread on this too but discovered this. I always had problems with the $ES_READONLY style. The vertical scrolling bar was enabled even though the input data was shorter than the input space and it was impossible to move it. Similarly if the input data was longer than the input space, the scrolling bar was activated but I couldn't move it therefore preventing me from reading the hidden input data to the right. I was using $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_MULTILINE, $ES_WANTRETURN, $ES_READONLY Maybe the styles I was using was overwriting one another(no BitOr maybe) but your script worked great! Thank you!
Lope Posted April 27, 2010 Author Posted April 27, 2010 Thanks guys, you're like AutoIt ninjas Last night after posting I thought of trying this with a label! lol (trying to add a scrollbar to a label) Works perfectly with the edit control thanks
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