Jump to content

Search the Community

Showing results for tags 'Edit'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

  1. This UDF can be used to simply edit an Listview. There will be created an inputfield at the position of the subitem, with enter you save, use esc to interrupt,... You can specify single rows and cols or single field (giving row and col,...), also you can specify, if a singleclick or a doubleclick is needed to edit. If you like it, please leave me a comment, also if you have any suggestions to make it better or if you found bugs. I reworked the UDF with AutoIt v3.3.16.1 and added the functionality to use tab to go to the next cell. Files without version numbers contain the current version. Changelog: v1.1.0: - Release v2.0.0: - Add the ability to switch to the next editable cell with tab - Rework to AutoIt v3.3.16.1 (partly) using maps v3.0.0: - Fully reworked to use maps instead of structs (more flexibility/performance) - Uses maps to save editable rows/cols to make ..._isCellEditable faster (No string parsing every time) - Bugfixes v3.0.1: - Fixes Bug with the registered keys not working systemwide v3.0.2: - Fixes Bug where the key input gui wide - The last edited item is now selected - The selection moves with the editable cell, when using ..__updateNextCellIndex (Using the tab key) ListViewEditInput_v1_1_0.au3 Example_v1_1_0.au3 Example_v2_0_0.au3 ListViewEditInput_v2_0_0.au3 Example.au3 ListViewEditInput.au3
  2. Hey guys! I just started working with the GUI yesterday and it has only brought more fun to the Autoit adventure Basically I have a GUI windows that opens and based on the selection of the combo box the button will do something different. This specific scenario I am talking about the Client Update Verification combo selection. When selected and the button is pressed my second gui window opens. As of now if I only paste comp1 or comp2 by itself it works correctly, but if I paste both, it has a fit. What would the correct way to do this be? Any help or examples, would be greatly appreciated! Thank you in advance #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Client_List.au3> #Region ### START Koda GUI section ### Form=c:\users\dnoble\pictures\plexiibox v4.kxf Global $Form1_1 = GUICreate("Plexii", 336, 419, 1548, 586) GUISetBkColor(0xFFFFFF) Global $Pic1 = GUICtrlCreatePic("C:\Users\dnoble\Pictures\plexii.jpg", 41, 0, 252, 268, BitOR($GUI_SS_DEFAULT_PIC,$SS_CENTERIMAGE)) Global $Label2 = GUICtrlCreateLabel("Select Test", 125, 280, 95, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") Global $Combo2 = GUICtrlCreateCombo("Select Test", 39, 312, 257, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Client Update Verification|Bids") GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Proceed", 111, 352, 129, 33) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Combo2) = "Client Update Verification" Then _Form2() ;clientupdateverification() EndSwitch WEnd Func _Form2() #Region ### START Koda GUI section ### Form=c:\users\dnoble\pictures\plexiiboxclientupdate verification.kxf $Form1_1 = GUICreate("Plexii", 336, 521, 866, 454) GUISetBkColor(0xFFFFFF) $Edit1 = GUICtrlCreateEdit("", 57, 72, 241, 345) GUICtrlSetData(-1, "Edit1") $Button1 = GUICtrlCreateButton("Execute", 95, 440, 145, 41) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Edit1) = "comp1" Then comp1() If GUICtrlRead($Edit1) = "comp2" Then comp2() EndSwitch WEnd EndFunc
  3. Hi, I have a problem with the scrollbar in edit control. In my case I use richedit, but it appears also in the "normal" editcontrol. The problem ONLY appears, when working with my program (including editcontrol) and another program like notpad on the other screen. It appears when using the scrollbar of notepad, then my scroll bar and so on ... (vertical scrollbars only) and then suddenly the area behind my scrollbar gets highlighted (black) like selected, above and below, if i move the mouse to the left during pressing, the whole area behind the scrollbar gets highlighted in black. When my program is loaded alone the problem NEVER happens. I have made two screenshots, 1st one when the problem appears, and the second one showing when moving to the left. I really have no idea and there is nothing special in my editcontrol. I would be really thankful, if someone could help me further to get this issue solved. thanks in advance cheers mike
  4. I am taking some idea from here: '?do=embed' frameborder='0' data-embedContent>> But what I am looking to accomplish is simple, I want to have an input box with a hidden input box below it. I will also have a defined list of items. When the text box has any value in it that does not directly equal an item in the pre defined list, the edit box should show. and populate suggested items based on whats being typed which I will do that part later, should be easy. I am stuck on a simple portion which should be easy and i'm not sure why I am having trouble with it. The way thr code below should work is, as long as there is a value in the Input box, the edit box will appear, if there is no value in the input box, the edit box should be hidden. here is what I have so far: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Input1 = GUICtrlCreateInput("", 64, 72, 313, 21) $Edit1 = GUICtrlCreateEdit("", 64, 96, 313, 177) GUISetState(@SW_SHOW) GUICtrlSetState($Edit1, $GUI_HIDE) While 1 $words = GUICtrlRead($Input1) If $words NOT = "" then GUICtrlSetState($Edit1, $GUI_SHOW) else GUICtrlSetState($Edit1, $GUI_HIDE) endif $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func flopdrop() If BitAnd($Edit1,2) AND $words = "" Then GUICtrlSetState($Edit1, $GUI_HIDE) Else GUICtrlSetState($Edit1, $GUI_SHOW) EndIf endfunc the problem with this is a nasty flicker when you move the mouse or do anything else. I will get rid of the scroll bars too, but thats once I solve this flicker issue. I know its happening because I have the check being performed within the While statement, but I can't think of any other way to do it.. I even tried using a timer to only check once every few seconds, but that didn't seem to work either: If $words NOT = "" AND (@SEC = 00 OR 10 OR 20 OR 30 OR 40 OR 50) AND (@MSEC < 20)) Then ; Blah blah blah endIf Does anyone have any thoughts or has anyone been able to do this? Thanks in advance!!
  5. Hello, very propably this has been asked before, well, I miss the thread(s) ... Is there a command line switch to tell the SciTE setup EXE to install silently ("/S") *AND* to end up with "edit" (instead of "run") as system wide default action for *.au3 files? As it can be done with the config tool: https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/SciTEConfigb1.PNG Regards, Rudi.
  6. Hi dears How are you? I have a question, to you please. How do I create an edit box for numbers only and does not accept letters? using autoit greetings to all I hope you help ME Thanks to all in advance
  7. Hi everyone , i'm trying to make some sort of full screen console window where some of the text must be non-editable like windows CMD.exe. Text already typed before pressing enter or the working folder 'C:\...>' is read only in CMD.exe and I want to know if mimicking this behavior in an edit control is possible. My attempt to make a console makes all the [A-Za-z0-9] keys a hotkey and the main edit control is set to read only. Every time the user types something the hotkey function is triggered, the cursor in the edit control is set to the end of the text and the character you typed is added to the edit. If you try to press the {backspace} key when you are at the edge of some text that is read only nothing happens. This works but I guess it is not the best or most clean way to make something like this.. Can someone give me some advice or help me make a better function for having full control over text in the edit control? kind regards, TheAutomator #include <GuiEdit.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form = GUICreate("Console", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $DS_SETFOREGROUND), $WS_EX_TOPMOST) GUISetBkColor(0x000000) $Console = GUICtrlCreateEdit('Loading...', 32, 32, @DesktopWidth-15, @DesktopHeight - 64, BitOR($ES_READONLY,$WS_VSCROLL), 0) GUICtrlSetFont(-1, 28, 400, 0, 'OCR A Extended') GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetCursor (-1, 2) _GUICtrlEdit_SetMargins( -1, $EC_RIGHTMARGIN, Default, 49) GUISetState(@SW_SHOW) ;################################################################################################################## Global $keys = 'abcdefghijklmnopqrstuvwxyz _ABCDEFGHIJKLMNOPQRSTUVWXYZ' ;################################################################################################################## For $_ = 1 To StringLen($keys) HotKeySet( StringMid($keys,$_,1), 'keypress') Next For $_ = 0 To 9 HotKeySet($_, 'keypress') HotKeySet('{numpad'&$_&'}', 'keypress') Next HotKeySet('{bs}','Keypress') HotKeySet('{enter}','Enter') _GUICtrlEdit_AppendText($Console, @CRLF&'Type a command:') $MIN = StringLen(GUICtrlRead($Console)) + 1 $MAX = $MIN ;################################################################################################################## Func Keypress() Local $key = @HotKeyPressed If StringLen($key) = 1 Then _GUICtrlEdit_AppendText($Console, $key) $MAX += 1 ElseIf StringRegExp($key,'\{numpad[0-9]\}') Then _GUICtrlEdit_AppendText($Console, StringMid($key,8,1)) $MAX += 1 ElseIf $key = '{bs}' Then If $max = $min then Return Else Local $len = StringLen(GUICtrlRead($Console)) _GUICtrlEdit_SetSel($Console, $len - 1, $len) _GUICtrlEdit_ReplaceSel($Console, '') $MAX -= 1 EndIf EndIf EndFunc Func Enter();handle typed commands when ENTER is pressed: Switch StringStripWS(StringLower(StringMid(GUICtrlRead($Console),$min,$max)),8) Case '' Beep(1000,50) Case 'clear' GUICtrlSetData($Console,'Command:') $MIN = StringLen(GUICtrlRead($Console)) + 1 $MAX = $MIN Return Case 'quit' Quit() Case Else _GUICtrlEdit_AppendText($Console, @CRLF&@TAB&'Unknown command!') EndSwitch _GUICtrlEdit_AppendText($Console, @CRLF&'Type a command:') $MIN = StringLen(GUICtrlRead($Console)) + 1 $MAX = $MIN EndFunc ;============================================================= Func Quit() _GUICtrlEdit_AppendText($Console, @CRLF&@TAB&'Goodbye...') Sleep(1500) Exit EndFunc While True If GUIGetMsg() = $GUI_EVENT_CLOSE Then Quit() EndIf WEnd
  8. Hi, I'm trying to create a console reader. All is working but I have a problem with the look. I want the line numbers with another backgroundcolor in silver. I made this with a small silver label. The edit control over the label has a transparent background. But if I start the prog then i can see how the line numbers wipe the silver background off. And if I click into the Edit then the silver label disappears completely. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode", 1) Global $g_iZaehler = 0 Global $g_hGUI = GUICreate("Console: StdoutRead" , 800, 800, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPCHILDREN, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $text = GUICtrlCreateEdit("",10,30,780,760, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY + $ES_NOHIDESEL) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $g_LaZeilen = GUICtrlCreateLabel("Zeilen: " & StringFormat("% 5d", $g_iZaehler), 680, 10, 100, 9, $SS_LEFTNOWORDWRAP) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKSIZE) Global $g_hCbFreeze = GUICtrlCreateCheckbox("&Freeze", 13, 5, 90) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlCreateLabel("", 11, 31, 42, 758) ; soll die Ziffern andersfarbig hinterlegen GUICtrlSetBkColor(-1, $COLOR_SILVER) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) Global $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) While 1 Sleep(200) $g_iZaehler += 1 $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) WEnd Func _Exit() Exit EndFunc Do you have any suggestions. Regards, Conrad
  9. Given an "Edit control" with Horizontal and Vertical scroll bars, setted with a monospace font, How can I know: 1) the exact client area dimension (excluding the surface of the Vert and Horiz. scroll bars ) 2) the dimensions (in pixel or whatever) of the hidden portions of the "Edit control" that are on the right and/or on the left and/or over the top and/or below the bottom of the visible part?, that is: if the content of the Edit control is completly visible, then there are not hidden portions, while if the content of the control is biggher of the visible area, then there are hidden parts. How to know the dimensions of the not visible portions of the Edit control on any given moment while I'm scrolling vertically and/or horizzontaly or if I change the dimensions of the font as well? For example, when I set the Font dimension = 7, the whole text is visible, so the scrollbars are grayed out and parameters of the hidden parts should be all 0. Since I'm sure that my explanation in english is not clear, I post this short script to show in practice the question: Thanks for any suggestion. #include <GUIConstants.au3> HotKeySet("{ESC}", "End") Local $aData Local $Char = " 1 2 3 4 5 6 7 8" & @CRLF $Char &= "12345678901234567890123456789012345678901234567890123456789012345678901234567890" & @CRLF For $i = 3 To 22 $Char &= StringFormat('%02i', $i) & _StringReplicate(" ", 7) & "|" & _StringReplicate(" |", 7) & @CRLF Next Global $MyGui = GUICreate("", 600, 430) Global $hEdit1 = GUICtrlCreateEdit($Char, 0, 0, 500, 300, BitOR($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_READONLY, $ES_MULTILINE)) GUICtrlSetFont(-1, 7, 0, 0, "Courier New") GUICtrlSetBkColor($hEdit1, 0xffffff) Local $idRadio1 = GUICtrlCreateRadio("Font size 7", 505, 10, 120, 20) Local $idRadio2 = GUICtrlCreateRadio("Font size 10", 505, 40, 120, 20) Local $idRadio3 = GUICtrlCreateRadio("Font size 12", 505, 70, 120, 20) Local $idRadio4 = GUICtrlCreateRadio("Font size 16", 505, 100, 120, 20) GUICtrlSetState($idRadio1, $GUI_CHECKED) GUICtrlCreateLabel("pixel hidden on the left : " & @CRLF & _ "pixel hidden on the right : " & @CRLF & _ "pixel hidden over the top : " & @CRLF & _ "pixel hidden below bottom : " & @CRLF & _ "Width of the edit : " & @CRLF & _ "Height of the edit : ", 5, 305, 400, 150) GUICtrlSetFont(-1, 12, 0, 0, "Courier New") Local $hParameters = GUICtrlCreateLabel("", 300, 305, 200, 150) GUICtrlSetFont(-1, 12, 0, 0, "Courier New") GUISetState() While 1 $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE End() Case $iMsg = $idRadio1 GUICtrlSetFont($hEdit1, 7, 0, 0, "Courier New") Case $iMsg = $idRadio2 GUICtrlSetFont($hEdit1, 10, 0, 0, "Courier New") Case $iMsg = $idRadio3 GUICtrlSetFont($hEdit1, 12, 0, 0, "Courier New") Case $iMsg = $idRadio4 GUICtrlSetFont($hEdit1, 16, 0, 0, "Courier New") EndSelect $aData = _CheckEdit($hEdit1) ; this should return actual parameters of the Edit <----- ??? how to get this data ??? GUICtrlSetData($hParameters, $aData[0] & @CRLF & $aData[1] & @CRLF & $aData[2] & @CRLF & $aData[3] & @CRLF & $aData[4] & @CRLF & $aData[5]) WEnd Func _CheckEdit($hEdit1) ; <----- ??? how to get this data about the passed Edit ??? Local $aData[6] $aData[0] = "???" ; Hidden pixels on the left $aData[1] = "???" ; Hidden pixels on the right $aData[2] = "???" ; Hidden pixels over the top $aData[3] = "???" ; Hidden pixels below bottom $aData[4] = "???" ; Width of the visible portion of the Edit (without scrollbar surface) $aData[5] = "???" ; Height of the visible portion of the Edit (without scrollbar surface) Return $aData EndFunc ;==>_CheckEdit ; returns one or more chars replicated n times ; Example: ConsoleWrite(_StringReplicate('*', 5) & @CRLF) Func _StringReplicate($sChars = "", $iRepeats = 0) $sChars = String($sChars) $iRepeats = Int(Abs(Number($iRepeats))) Return StringReplace(StringFormat('%' & $iRepeats & 's', ""), " ", $sChars) EndFunc ;==>_StringReplicate Func End() If WinActive("[ACTIVE]") = $MyGui Then Exit EndIf EndFunc ;==>End
  10. Hello! I think the thread title is obvious enough , Here is my code: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 290, 139, 192, 124) $Edit1 = GUICtrlCreateEdit("Test", 8, 8, 273, 121, $ES_READONLY) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Thanks in advance, TD
  11. Hello. First of all, my full code: #include <WinAPI.au3> #include <File.au3> #include <String.au3> Local $aFiles, $IntOrFloat Local $aFileToRead = _WinAPI_GetOpenFileName("Open file to read", "Text Files (*.txt)") Local $aFinalFile = _WinAPI_GetSaveFileName("How do you want to save the file?", "Text Files (*.txt)") Local $sFilenameWithoutExtension = _StringBetween($aFinalFile[2],"",".") Local $sLinesPerLine = InputBox("Lines Per Line", "How many lines per line do you want?","","") Local $sCountLines = _FileCountLines($aFileToRead[2]) If ($sCountLines/$sLinesPerLine) >= 1 Then ; When the division result is a number with decimal, there will be less words in the last file and the script won't create it , therefore I add 1 to the result to prevent a file lack. Am I wrong? For example: if user introduces 3 the operation will be "4/3=1.33" and I need two files, the first "line1,line2,line3" and the second "line4". $IntOrFloat = $sCountLines/$sLinesPerLine Else $IntOrFloat = ($sCountLines/$sLinesPerLine) + 1 EndIf For $i = 1 To $IntOrFloat MsgBox(0,"", "Creating file " & $i) $aFiles = $aFinalFile[1] & "\" & $sFilenameWithoutExtension[0] & "-" & $i & ".txt" _FileCreate($aFiles) FileOpen($aFiles,2) For $a = ( ( ( $i - 1 ) * $sLinesPerLine ) + 1 ) To ( $i * $sLinesPerLine ) FileWrite($aFinalFile[2],FileReadLine($aFileToRead[2], $a) & ",") Next FileClose($aFiles) Next MsgBox(0,"Done","Done")With it I want to read a text file with a lot of lines and I wanna split it in multiple files with multiple lines (of the first file) in each line, separated by commas. For example: the user executes the script and selects a text file to open that contains: Then, the user selects the path and name of the result files. Suppose "C:\result.txt" Finally, the user introduces the number of lines per line (lines of the initial text file to each line of the result text files). Suppose the user enters 2. So far my code works fine. But I tried to code a loop for do (continuing the example): Start first loop repetition.Create "C:\result.-1.txt", and write on it "Line 1 asdf,Line 2 asdf"End first loop repetition.Start second loop repetition.Create "C:\result.-2.txt", and write on it "Line 3 asdf,Line 4 asdf"End second loop repetition.But my code results (continuing the example) in three files created: C:\result.txt that contains "Line 1 asdf,Line 2 asdf,Line 3 asdf,Line 4 asdf,"C:\result.-1.txt that contains nothing.C:\result.-2.txt that contains nothing.Where is the error? I can't understand where is it...
  12. Hi Everyone, I'm facing a small issue while trying to remove spaces at the end of lines contained in a temp file. Indeed, I'm creating the list of uninstallable apps on my computer and display them in an edit box. Here's the result: As you can see, all lines have bunch of spaces at their end. I did try the StringStripWS function, the StringTrimLeft one... no one works... Here's the code I use: Func f_ListApps() GuiCtrlSetState ($g_AppList, $GUI_DISABLE) RunWait(@ComSpec & ' /c ' & 'wmic /node:' & @Computername &' product get name > %temp%\model.txt' ,"", @SW_HIDE) $file =(@TempDir & "/model.txt") $fileread = FileRead($file) GUICtrlCreateEdit($fileread, 5, 250, 395, 400) FileDelete(@TempDir & "/model.txt") EndFuncSurely a dumbass question but few hairs remains on my head Thanks
  13. Hi, simple question actually: How to disable the character limit for an edit control? Want unlimited-length (or as much as possible) I know the GUICtrlSetLimit() function but i want to disable the limit, not set one... Any ideas? I thought there was some sort of autoit constant for this or something but cant find what i'm looking for.
  14. Hey ya'll. I'm making a something like the Windows 7-app Sticky-note consisting of unspecified numbers of "note"-GUIs with RichEdits in them. The problem I'm facing is that for the RichEdit to work it requires the hWnd of its GUI (which can be solved by just having a variable that's getting replaced as new "notes" are being made), but the next problem is to read the handle/ID of the RichEdit for further functions. This is what it looks like atm: #cs Unlimited, controlable windows #ce Opt("GUIOnEventMode", 1) Opt("TrayMenuMode", 1 + 2) Opt("TrayOnEventMode",1) #include <array.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <TrayConstants.au3> #include <GuiRichEdit.au3> TrayCreateItem("LAN-notes") TrayItemSetState(-1, $TRAY_DISABLE) TrayCreateItem("") TrayCreateItem("New") TrayItemSetOnEvent(-1, "New") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"TrayExit") TraySetState(1) $hWnd = GUICreate("",0,0) GUISetState(@SW_HIDE,-1) Call("New") while 1 Sleep(10) #cs $GUI_CurrentSize = WinGetPos($hGui) If $GUI_CurrentSize[2] <> $GUI_PrevSize[0] Or $GUI_CurrentSize[3] <> $GUI_PrevSize[1] Then _WinAPI_MoveWindow($Edit1,0,20,$GUI_CurrentSize[2]-20,$GUI_CurrentSize[3]-60) $GUI_PrevSize[0] = $GUI_CurrentSize[2] $GUI_PrevSize[1] = $GUI_CurrentSize[3] EndIf #ce WEnd Func New() $p = GUICreate("LAN-notes - ",200,200,Default,Default,BitOR($ws_sizebox,$WS_MINIMIZEBOX),Default,$hWnd) $winlist = WinList("LAN-notes") GUISetOnEvent($GUI_EVENT_CLOSE, "MainEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "MainEvents") GUICtrlCreateButton("+",0,0,20,20) GUICtrlSetFont(-1,12) GUICtrlSetOnEvent(-1,"New") GUICtrlCreateButton("Save",22,0,35,20) GUICtrlSetOnEvent(-1,"Save") ;GUICtrlCreateButton("Test", 50,80) ; GUICtrlSetOnEvent(-1,"Test") GUICtrlCreateInput("",60,0,105,20) GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlCreateButton("Edit",165,0,35,20) GUICtrlSetOnEvent(-1,"EditProjName") _GUICtrlRichEdit_Create($p, "",0,25,180,160, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_WANTRETURN,$ES_MULTILINE)) GUISetState() EndFunc Func Test() $winlist = WinList("LAN-notes") _ArrayDisplay($winlist) EndFunc Func MainEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE If WinExists("LAN-notes") Then If MsgBox(4,"Exit?","You sure you want to close this note?") = 6 Then GUIDelete(@GUI_WinHandle) EndIf EndSelect EndFunc Func EditProjName() ConsoleWrite("Edit projName" & @CRLF) If GUICtrlGetState(@GUI_CtrlId-1) = 144 Then GUICtrlSetState(@GUI_CtrlId-1,$GUI_ENABLE) GUICtrlSetData(@GUI_CtrlId,"Done") Else WinSetTitle(@GUI_WinHandle,"","LAN-notes - " & GUICtrlRead(@GUI_CtrlId-1)) GUICtrlSetState(@GUI_CtrlId-1,$GUI_DISABLE) GUICtrlSetData(@GUI_CtrlId,"Edit") EndIf EndFunc Func Save() ConsoleWrite("--> Save" & @CRLF) ConsoleWrite(_GUICtrlRichEdit_GetText(@GUI_CtrlId+4) & @CRLF) EndFunc Func TrayExit() ConsoleWrite("TrayExit") Exit EndFunc Thanks, zvvyt
  15. Hello all I was wondering if AutoIT is able to create a numbered edit control like SciTE.
  16. RESTRICT EDIT UDF Restrict the text that can be entered in an editbox through a String Regular Expression. The UDF works be subclassing the control. >Here is a similar UDF based on Windows Message. Functions The UDF is pretty simple and could be modified with ease. User can set their SRE pattern to block the text entered in the editbox Tooltips can be used in case of an error. The title of the Tooltip is Error_2 where the number(2) signifies the pattern that caused the error. The script is made to use function pointer variables rather than direct patterns, to make it more flexible and broader. Supports +ve and -ve SRE pattern matches. See example for better understanding. Note : The Pattern should be made such that every phase of typing is met, Example, if the user wants The second letter should be always a digit. Then he should make sure that the pattern is also satisfied when user enters the first character, as through the process of typing. Index ; #INDEX# ======================================================================================================================= ; Title .........: RestrictEdit ; Version........: 1.0 ; AutoIt Version : 3.3.8.0++ ; Language ......: English ; Author(s)......: Phoenix XL ; Librarie(s)....: WinAPI, Array and GUIEdit ; Description ...: Functions for restricting the text typed in an Edit control through SRE. ; The edit control is subclassed and the original processing is blocked when pattern isn't satisfied. ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_Restrict_Edit ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ; HideToolTip_Edit ;_NewWnd_Proc_ ;_SubClass_ ; =============================================================================================================================== ChangeLog v1.0 - First Release v2.0 - Replaced the SRE pattern parameter(2nd parameter) with function pointer parameter[A script Breaking change]. Added support for positive and negative pattern matches Download v2.0 RestrictEdit(UDF).7z Previous downloads : 161
  17. I wonder if there is a way to set tab stops for a label control similarly as used by the Gary Frost's UDF _GUICtrlEdit_SetTabs($hWnd, $aTabStops) for edit controls ? This would allow me to e.g. vertically aligned text along self-defined tab stops using @TAB. I get similar effects using the edit control and making it look like a label (see example) ... or any other ideas? Cheers Mungo #include <GUIConstantsEx.au3> #include <GuiEdit.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $f_size = 10 Local $tab_stops_a[4] = [5, 20, 200] ; Define stab stops Local $h_win = GUICreate ( "TEST GUI ... Set TAB stops", 500, 350) GUISetBkColor(0xffffff, $h_win) GUISetFont(10, 400, 0, "Arial", $h_win, 2) GUICtrlCreateLabel("Test: Set TAB stops ...", 10, 10) GUICtrlCreateLabel("Using LABEL ctrl with default tab stops ...", 10, 40, 380, 20) GUICtrlCreateLabel(@TAB &"-" &@TAB & "Col 1 - Some longer column text" &@TAB & "[Col 2 - Units]", 10, 60, 450, 20) GUICtrlCreateLabel(@TAB &"-" &@TAB & "Col 1 - Short text" &@TAB & "[Col 2 - Units]", 10, 80, 450, 20) GUICtrlCreateLabel("Using EDIT ctrl and setting tab stops where I want them to be ...", 10, 120, 380, 20) GUICtrlCreateEdit(@TAB &"-" &@TAB & "Col 1 - Some longer column text" &@TAB & "[Col 2 - Units]", 10, 140, 450, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY), 0) GUICtrlSetBkColor(-1, 0xffffff) _GUICtrlEdit_SetTabStops(-1, $tab_stops_a) GUICtrlCreateEdit(@TAB &"-" &@TAB & "Col 1 - Short text" &@TAB & "[Col 2 - Units]", 10, 160, 450, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY), 0) GUICtrlSetBkColor(-1, 0xffffff) _GUICtrlEdit_SetTabStops(-1, $tab_stops_a) Local $button = GUICtrlCreateButton("Close", 210, 310, 80, 20) GUISetState(@SW_SHOW) While 1 Local $msg_pop = GUIGetMsg() Select Case $msg_pop = $GUI_EVENT_CLOSE ExitLoop Case $msg_pop = $button ExitLoop EndSelect WEnd GUIDelete() EndFunc
  18. For example my GUICtrlCreateEdit() contains: Line 1 Line 2 Line 3 When I IniWrite() the content of it, the value will be look like this: [SectionName] Key=Line 1 Line 2 Line 3 But when I IniRead() that key like this: GUICtrlCreateEdit(IniRead(@ScriptDir & "/data.ini", "SectionName", "Key", ""), 1, 1, 200, 100) The value of the GUI edit field is only "Line 1".. How can I INI write and read a text with line breaks in a GUICtrlCreateEdit() ?
  19. I know this has been asked before, but finding it, is a different case all together. Even searched google.com and was able to see the a properties window that had a radio button, but could not find in Scite the option. Can someone tell me where to change the default behavior of Scite to open or edit the au3 files? http://www.autoitscript.com/autoit3/scite/docs/SciTEConfig.html - where is the window they are showing located in scite? I fell dumb
  20. Greetings, I was wondering if anyone had any thoughts on this issue... I am working on a GUI that will perform various AD changes.. I stripped down the program big time to test this edit box issue I am having. PROBLEM: When importing a large list from any data source, as the data is filling in an edit box, the edit box scrolls the vertical bar for each item. As the list grows larger, the import slows down ALOT because of the scrolling. Here is a working example of the butchered GUI: ( THIS IS ALSO ATTACHED ) #include <APIConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <ListViewConstants.au3> #include <file.au3> #include <StaticConstants.au3> #include <GUIListViewEx.au3> global $a = 1, $b = 1, $i = 1 HotKeySet("{ESC}", "Terminate") Func Terminate() ProcessClose ( "autoit3.exe" ) Exit 0 EndFunc ;==>Terminate #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 827, 585, -1, -1) $sourcebox = _GUICtrlListView_Create($Form1, "User name", 8, 32, 321, 545, BitOR($LVS_DEFAULT, $WS_BORDER, $LVS_EDITLABELS)) _GUICtrlListView_SetColumnWidth($sourcebox, 0, 200) $importlistdata = _GUIListViewEx_Init($sourcebox, "", 0, 0x00FF00) ;GUICtrlSetLimit(-1, 9900000) $sucbo = GUICtrlCreateEdit("", 560, 272, 249, 201) $failbox = GUICtrlCreateEdit("", 560, 32, 249, 201) ;$Combo1 = GUICtrlCreateCombo("Combo1", 352, 80, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) ;$L_option1 = GUICtrlCreateLabel("Option 1", 352, 56, 44, 17) ;$Combo2 = GUICtrlCreateCombo("Combo1", 352, 136, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) ;$L_option2 = GUICtrlCreateLabel("Option 1", 352, 112, 44, 17) ;$Combo3 = GUICtrlCreateCombo("Combo1", 352, 192, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) ;$L_option3 = GUICtrlCreateLabel("Option 1", 352, 168, 44, 17) ;$Combo4 = GUICtrlCreateCombo("Combo1", 352, 248, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) ;$L_option4 = GUICtrlCreateLabel("Option 1", 352, 224, 44, 17) $oldhome = GUICtrlCreateInput("", 352, 312, 121, 21) $L_option5 = GUICtrlCreateLabel("Old Home", 352, 288, 100, 17) $newhome = GUICtrlCreateInput("Input1", 352, 368, 121, 21) $L_option7 = GUICtrlCreateLabel("New Home", 352, 344, 100, 17) $B_Verify = GUICtrlCreateButton("Verify", 640, 520, 75, 57) $B_start = GUICtrlCreateButton("S T A R T", 728, 520, 75, 57) $Label_lable = GUICtrlCreateLabel("Paste list here", 8, 8, 70, 17) $Label_Success = GUICtrlCreateLabel("Success", 560, 248, 45, 17) $Label_Failed = GUICtrlCreateLabel("Failed", 560, 8, 32, 17) $Group1 = GUICtrlCreateGroup("Options", 344, 32, 185, 377) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Status", 344, 424, 185, 145) $stat1 = GUICtrlCreateLabel("READY", 352, 440, 166, 56, $SS_CENTER) GUICtrlSetFont(-1, 32, 400, 0, "Arial Narrow") $stat2 = GUICtrlCreateLabel($a & "/" & $b, 352, 504, 166, 56, $SS_CENTER) GUICtrlSetFont(-1, 32, 400, 0, "Arial Narrow") GUICtrlCreateGroup("", -99, -99, 1, 1) $import = GUICtrlCreateButton("import", 552, 520, 75, 57) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### global $MuhVal While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $import import() EndSwitch WEnd Func import() local $zInput Local $var = FileOpenDialog("Select only one file.", @ScriptDir & "\", "Files (*.txt)", 1) If @error Then Return Else _FileReadToArray($var, $zInput) For $i = 1 To UBound($zInput) - 1 _GUIListViewEx_Insert($zInput[$i]) GUICtrlSetData($stat2, 1 & "/" & $i) Next EndIf EndFunc ;==>import The only button I have set up is Import. I have Esc set up as a hot key to kill the app if you need it. I am also including a demo file with 3200 lines.. Use the program to import the file, and you will see it slow down badly when it goes over 100 lines. Does anyone have any tips or tricks how to get past this? myfile.txt list processor.au3
  21. Hey guys! I just started to work on a script to convert/encrypt strings in a simple GUI. First of all, here is my code: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <String.au3> $Form1 = GUICreate("Form1", 615, 438, 574, 290) $Text = GUICtrlCreateEdit("", 8, 40, 601, 353) GUICtrlSetData(-1, "") $Convert = GUICtrlCreateButton("Convert", 8, 400, 297, 33) $Close = GUICtrlCreateButton("Close", 312, 400, 297, 33) $StringReverse = GUICtrlCreateRadio("String Reverse", 16, 8, 89, 17) $StringEncrypt = GUICtrlCreateRadio("String Encrypt", 128, 8, 89, 17) $Frame1 = GUICtrlCreateGroup("", 8, 0, 105, 33) GUICtrlCreateGroup("", -99, -99, 1, 1) $Password = GUICtrlCreateInput("", 216, 8, 385, 21) $Frame2 = GUICtrlCreateGroup("", 120, 0, 489, 33) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Close Exit Case $Convert If GUICtrlRead($StringReverse) = 1 Then $ReadText = GUICtrlRead($Text) $ReverseText = _StringReverse($ReadText) GUICtrlSetData($Text, $ReverseText) ElseIf GUICtrlRead($StringEncrypt) = 1 Then $ReadText = GUICtrlRead($Text) $ReadPassword = GUICtrlRead($Password) If $ReadPassword = Not 0 Then $TextEncrypt = _StringEncrypt(1, $ReadText, $ReadPassword) GUICtrlSetData($Text, $TextEncrypt) Else MsgBox(0,"Error","String encryption requires a password") EndIf Else MsgBox(0,"Error","No manipulation method specified") EndIf EndSwitch WEnd The problem with this is, if i want to convert for example somthing like this: "String1" "String2" "String3" GUICtrlRead will read it as "String1""String2""String3". I tried to mess around with StringSplit, but can't get it to work. Any indeas?
  22. I have already made a regarding the same issue. But its old enough to start the discussion again there. I wanted to have a custom scrollbar for an edit control. This is the script, it works as required. CScrollBar #include-once #include <GDIP.au3> ;http://www.autoitscript.com/forum/topic/106021-gdipau3/ #include <WinAPIEx.au3> #include <GuiConstantsEx.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> #include <Misc.au3> #include <GUIEdit.au3> #include <Array.au3> Global $iWidth_VSCROLL = _WinAPI_GetSystemMetrics($SM_CXVSCROLL) Global $hGraphic, $hGraphicGUI, $hBMPBuff ;Double-Click Global $iDoubleClickTime = DllCall("user32.dll", "uint", "GetDoubleClickTime") $iDoubleClickTime = $iDoubleClickTime[0] ;User-Custom Messages Global $WM_UPDATETHUMB = $WM_APP + 11 ;Called when the height of the thumb has to be changed. Global $WM_THUMBMOVE = $WM_APP + 12 ;Called when the Thumb has been clicked Global $WM_ARROWDOWN = $WM_APP + 13 ;Called when the Arrow buttons have been clicked. Global $WM_PAINTSCROLLBAR = $WM_APP + 14 ;Implements the painting of the scroll bar over the NC area of the EditBox. Global Const $tagNCCALCSIZE_PARAMS = $tagRECT & ";" & $tagRECT & ";" & $tagRECT & ";ptr PWINDOWPOS" ; Register callback function and obtain handle to _New_WndProc Global $___hNew_WndProc = DllCallbackRegister("_New_WndProc", "int", "hwnd;uint;wparam;lparam") ; Get pointer to _New_WndProc Global $___pNew_WndProc = DllCallbackGetPtr($___hNew_WndProc) Global $___cEdit ; Handle of the Edit Global $___pOld_WndProc ; Old Window Procedure's Address _GDIPlus_Startup() Global $hPen = _GDIPlus_PenCreate(0xAAFCD667, 2), _ $hBrush = _GDIPlus_BrushCreateSolid(0xAAFCD667), _ $hFormat = _GDIPlus_StringFormatCreate(), _ $hFamily = _GDIPlus_FontFamilyCreate("Wingdings"), _ $hPath = _GDIPlus_PathCreate() Func Startup_CustomScrollBar($hEdit) $___cEdit = $hEdit ;get the handle of the edit $___pOld_WndProc = _SubClass($hEdit, $___pNew_WndProc) ;store the old WndProc ;post a WM_NCCALCSIZE msg. _WinAPI_SetWindowPos($hEdit, Default, Default, Default, Default, Default, $SWP_FRAMECHANGED) EndFunc ;==>Startup_CustomScrollBar Func Shutdown_CustomScrollBar();Mem Release ;unsubclass the control _SubClass($___cEdit, $___pOld_WndProc) ;dispose the resources _Gdiplus_PathDispose($hPath) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontFamilyDispose($hFamily) DllCallbackFree($___hNew_WndProc) EndFunc ;==>Shutdown_CustomScrollBar ;The path of the Top Arrow button ;This could be rotated to obtain the Bottom Arrow button's path. Func TopBtn_Path(ByRef $hPath, $iX, $iY, $iSide) ;* Not required when the path is in order. _GDIPlus_PathStartFigure($hPath) ;* _GDIPlus_PathAddLine($hPath, $iX + $iSide, $iY + $iSide, $iX + $iSide, $iY) _GDIPlus_PathAddLine($hPath, $iX + $iSide, $iY, $iX, $iY) _GDIPlus_PathAddLine($hPath, $iX, $iY, $iX, $iY + $iSide) _GDIPlus_PathAddArc($hPath, $iX, $iY + $iSide / 2, $iSide, $iSide, 180, 180) _GDIPlus_PathCloseFigure($hPath) ;* EndFunc ;==>TopBtn_Path ;The Path of the Thumb Func ThumbBtn_Path(ByRef $hPath, $iX, $iY, $iHeight, $iSide) ;* Not required when the path is in order. _GDIPlus_PathStartFigure($hPath) ;* _GDIPlus_PathAddLine($hPath, $iX, $iY, $iX, $iY + $iHeight) _GDIPlus_PathAddArc($hPath, $iX, $iY + $iHeight - $iSide / 2, $iSide, $iSide, 180, -180) _GDIPlus_PathAddLine($hPath, $iX + $iSide, $iY + $iHeight, $iX + $iSide, $iY) _GDIPlus_PathAddArc($hPath, $iX, $iY - $iSide / 2, $iSide, $iSide, -180, 180) _GDIPlus_PathCloseFigure($hPath) ;* EndFunc ;==>ThumbBtn_Path Func _SubClass($hWnd, $pNew_WindowProc) Local $iRes = _WinAPI_SetWindowLong($hWnd, -4, $pNew_WindowProc) If @error Then Return SetError(1, 0, 0) If $iRes = 0 Then Return SetError(1, 0, 0) Return SetError(0, 0, $iRes) EndFunc ;==>_SubClass ;The new window procedure of the edit control. Func _New_WndProc($hWnd, $iMsg, $wParam, $lParam) Static $aRegion[3], $i_Thumb_Height = -1, $i_TrackHeight, $iY_Thumb = -1, $iPixel_Per_Line_Scale = 1, $iThumb_Pic = 0, $iTrack_Pic = 0 Static $hDC, $hGfx Switch $iMsg Case $WM_NCCALCSIZE $tNCCALCSIZE_PARAMS = DllStructCreate($tagNCCALCSIZE_PARAMS, $lParam) DllStructSetData($tNCCALCSIZE_PARAMS, 1, DllStructGetData($tNCCALCSIZE_PARAMS, 1) + 2) DllStructSetData($tNCCALCSIZE_PARAMS, 2, DllStructGetData($tNCCALCSIZE_PARAMS, 2) + 2) DllStructSetData($tNCCALCSIZE_PARAMS, 3, DllStructGetData($tNCCALCSIZE_PARAMS, 3) - 2 - $iWidth_VSCROLL) ;Space for VSCROLL Bar DllStructSetData($tNCCALCSIZE_PARAMS, 4, DllStructGetData($tNCCALCSIZE_PARAMS, 4) - 2) Return 0 Case $WM_NCPAINT ;the first draw. If $i_Thumb_Height = -1 Then _SendMessage($hWnd, $WM_UPDATETHUMB, 0, 0) Case $WM_PAINTSCROLLBAR $iRet = _WinAPI_CallWindowProc($___pOld_WndProc, $hWnd, $iMsg, _ $wParam, $lParam) $iWidth = _WinAPI_GetWindowWidth($hWnd) - _WinAPI_GetClientWidth($hWnd) - 4 $iHeight = _WinAPI_GetClientHeight($hWnd) ;Set the Range SetInRange($i_Thumb_Height, 15, $i_TrackHeight) SetInRange($iY_Thumb, 0, $i_TrackHeight - $i_Thumb_Height) $hHbmp = hHbmp_ScrollButtons_And_Track($iWidth, $iHeight, 0xFF000000 + GUICtrlGetBkColor($hWnd, _WinAPI_GetClientWidth($hWnd), $iHeight), $aRegion, _Iif($iY_Thumb < 0, 0, $iY_Thumb), $i_Thumb_Height) ; GUICtrlSendMsg($iTrack_Pic, 370, $IMAGE_BITMAP, $hHbmp) ;370 = $STM_SETBITMAP _WinAPI_DeleteObject($hHbmp) _WinAPI_EmptyWorkingSet() Return $iRet Case $WM_NCHITTEST $tPoint = DllStructCreate($tagPoint) DllStructSetData($tPoint, 1, _WinAPI_LoWord($lParam)) DllStructSetData($tPoint, 2, _WinAPI_HiWord($lParam)) _WinAPI_ScreenToClient($hWnd, $tPoint) $tRect = Return_CLientRect($hWnd) If _WinAPI_PtInRect($tRect, $tPoint) Then Return $HTBORDER Case $WM_NCLBUTTONDOWN $tPoint = _WinAPI_GetMousePos(True, $hWnd) If _GDIPlus_RegionIsVisiblePoint($aRegion[0], DllStructGetData($tPoint, 1) - _WinAPI_GetClientWidth($hWnd) - 2, DllStructGetData($tPoint, 2) - 2, $hGfx) Then _WinAPI_PostMessage($hWnd, $WM_ARROWDOWN, $SB_LINEUP, 0) ElseIf _GDIPlus_RegionIsVisiblePoint($aRegion[1], DllStructGetData($tPoint, 1) - _WinAPI_GetClientWidth($hWnd) - 2, DllStructGetData($tPoint, 2) - 2, $hGfx) Then _WinAPI_PostMessage($hWnd, $WM_ARROWDOWN, $SB_LINEDOWN, 1) ElseIf _GDIPlus_RegionIsVisiblePoint($aRegion[2], DllStructGetData($tPoint, 1) - _WinAPI_GetClientWidth($hWnd) - 2, DllStructGetData($tPoint, 2) - 2, $hGfx) Then _WinAPI_PostMessage($hWnd, $WM_THUMBMOVE, 0, 0) Else $tRect = Return_CLientRect($hWnd) If _WinAPI_PtInRect($tRect, $tPoint) Then $iY_Thumb = DllStructGetData($tPoint, 2) - (($i_Thumb_Height / 2) + ($iWidth_VSCROLL - 2)) $iLine_Scroll = Floor(($iY_Thumb / $iPixel_Per_Line_Scale)) $iLine_Scroll_Count = $iLine_Scroll - _GUICtrlEdit_GetFirstVisibleLine($hWnd) _SendMessage($hWnd, $EM_LINESCROLl, 0, $iLine_Scroll_Count) _SendMessage($hWnd, $WM_PAINTSCROLLBAR, 0, 0) EndIf EndIf Case $WM_CHAR, $WM_UNDO, $EM_UNDO, $WM_HOTKEY _WinAPI_PostMessage($hWnd, $WM_UPDATETHUMB, 0, 0) Case $WM_SIZE, $WM_SIZING $iRet = _WinAPI_CallWindowProc($___pOld_WndProc, $hWnd, $iMsg, _ $wParam, $lParam) $aPos = ControlGetPos("", "", $hWnd) If $iTrack_Pic Then GUICtrlSetPos($iTrack_Pic, $aPos[0] + 2 + _WinAPI_GetClientWidth($hWnd), $aPos[1] + 2, $iWidth_VSCROLL, _WinAPI_GetClientHeight($hWnd)) Else $iTrack_Pic = GUICtrlCreatePic("", $aPos[0] + 2 + _WinAPI_GetClientWidth($hWnd), $aPos[1] + 2, $iWidth_VSCROLL, _WinAPI_GetClientHeight($hWnd)) GUICtrlSetBkColor(-1, 0) EndIf _SendMessage($hWnd, $WM_UPDATETHUMB) If $hDC Then ;release the old ones _GDIPlus_GraphicsDispose($hGfx) _WinAPI_ReleaseDC($hDC, $hWnd) EndIf ;update the new graphics and DC $hDC = _WinAPI_GetWindowDC($hWnd) $hGfx = _GDIPlus_GraphicsCreateFromHDC($hDC) Return $iRet Case $WM_KEYDOWN Switch $wParam Case $VK_DOWN, $VK_UP, $VK_PRIOR, $VK_NEXT ;Down $iRet = _WinAPI_CallWindowProc($___pOld_WndProc, $hWnd, $iMsg, _ $wParam, $lParam) _SendMessage($hWnd, $WM_UPDATETHUMB) Return $iRet Case $VK_END, $VK_HOME If _IsPressed("11") Then ;CTRL Pressed _SendMessage($hWnd, $WM_VSCROLL, _WinAPI_MakeLong($SB_BOTTOM + $VK_END - $wParam, 0)) $iY_Thumb = _Iif($wParam = $VK_END, $i_TrackHeight - $i_Thumb_Height, 0) ;Redraw the window, _Winapi_RedrawWindow didn't work _SendMessage($hWnd, $WM_PAINTSCROLLBAR) EndIf EndSwitch Case $WM_MOUSEWHEEL $iDelta = _WinAPI_HiWord($wParam) $iCount = Abs($iDelta) / 120 For $i = 1 To $iCount _SendMessage($hWnd, $WM_ARROWDOWN, _Iif($iDelta > 0, $SB_LINEUP, $SB_LINEDOWN), -$iDelta) Next Case $WM_UPDATETHUMB ;Calculate the required vars $i_LineCount = _GUICtrlEdit_GetLineCount($hWnd) $i_ScrollBarHeight = _WinAPI_GetClientHeight($hWnd) $i_LineHeight = GetLineHeight($hWnd) $iMax_LineVisible = Floor($i_ScrollBarHeight / $i_LineHeight) $i_PageHeight = $i_LineCount * $i_LineHeight $i_TrackHeight = $i_ScrollBarHeight - (2 * ($iWidth_VSCROLL - 2)) $i_CurLine = _GUICtrlEdit_GetFirstVisibleLine($hWnd) ;Set the Thumb size $i_Thumb_Height = $i_TrackHeight * ($iMax_LineVisible * $i_LineHeight / $i_PageHeight) ;Set the Scale $iPixel_Per_Line_Scale = ($i_TrackHeight - $i_Thumb_Height) / ($i_LineCount - $iMax_LineVisible) ;Set the Thumb Pos $iY_Thumb = (($i_CurLine / ($i_LineCount - $iMax_LineVisible)) * ($i_TrackHeight - $i_Thumb_Height)) ;Redraw the window, _Winapi_RedrawWindow didn't work _SendMessage($hWnd, $WM_PAINTSCROLLBAR, 0, 0) Case $WM_THUMBMOVE $iLine_InPage = _WinAPI_GetClientHeight($hWnd) / GetLineHeight($hWnd) $Y_Offset = _WinAPI_GetMousePosY(True, $hWnd) - $iY_Thumb $iY_Thumb_Prev = $iY_Thumb Local $iOutofBounds = False While _IsPressed("01") $Mouse_Y = _WinAPI_GetMousePosY(True, $hWnd) #cs - need to be improved Select ;halt if out of bounds Case $Mouse_Y < $Y_Offset Or $Mouse_Y - $Y_Offset > $i_TrackHeight - $i_Thumb_Height Switch $iOutofBounds Case True Sleep(10) ContinueLoop Case False $iOutofBounds = True EndSwitch EndSelect #ce Switch $Mouse_Y - $Y_Offset ;pause if mouse isn't moved Case $iY_Thumb Sleep(10) ContinueLoop Case Else $iY_Thumb = $Mouse_Y - $Y_Offset $iOutofBounds = True $iLine_Scroll = Floor(($iY_Thumb / $iPixel_Per_Line_Scale)) $iLine_Scroll_Count = $iLine_Scroll - _GUICtrlEdit_GetFirstVisibleLine($hWnd) _SendMessage($hWnd, $EM_LINESCROLl, 0, $iLine_Scroll_Count) _SendMessage($hWnd, $WM_PAINTSCROLLBAR) Sleep(20) EndSwitch WEnd Case $WM_ARROWDOWN ;lParam = +ve : Down Arrow lParam = -ve : Up Arrow Local $iDirection = $wParam If $wParam = 0 Then $iDirection = _Iif($lParam > 0, $SB_LINEDOWN, $SB_LINEUP) _GUICtrlEdit_Scroll($hWnd, $iDirection) $iY_Thumb = _Iif($lParam > 0, $iY_Thumb + $iPixel_Per_Line_Scale, $iY_Thumb - $iPixel_Per_Line_Scale) _SendMessage($hWnd, $WM_PAINTSCROLLBAR, 0, 0) ;Continuous dragging Static $i_Start_Drag = False If _IsPressed("01") And $i_Start_Drag = False Then $iTimer = TimerInit() While _IsPressed("01") If TimerDiff($iTimer) >= $iDoubleClickTime Then $i_Start_Drag = True ExitLoop EndIf WEnd EndIf If _IsPressed("01") Then Sleep(15) _WinAPI_PostMessage($hWnd, $WM_ARROWDOWN, $wParam, $lParam) Else $i_Start_Drag = False EndIf EndSwitch ; Pass to the Original Window Procedure. Return _WinAPI_CallWindowProc($___pOld_WndProc, $hWnd, $iMsg, _ $wParam, $lParam) EndFunc ;==>_New_WndProc Func hHbmp_ScrollButtons_And_Track($iWidth, $iHeight, $iBkColor, ByRef $aRegion, $iThumb_Y, $iThumb_Height) If $iHeight < 2 * ($iWidth_VSCROLL - 2) Then Return 0 Local $hFont = _GDIPlus_FontCreate($hFamily, $iWidth_VSCROLL / 2 - 1, 2) ;Image Containing the Scroll Bar $hBmp = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) $hGfx_Bmp = _GDIPlus_ImageGetGraphicsContext($hBmp) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Bmp, 2) _GDIPlus_GraphicsClear($hGfx_Bmp, $iBkColor) ;Set Bkcolor of the Bmp to that of the Edit #cs - Doesn't work as expected ;Invalidate and erase the part of the edit containing ScrollBar. $tRect = Return_CLientRect($hWnd, $iX, $iY, $iX + $iWidth, $iY + $iHeight) _WinAPI_RedrawWindow($hWnd, $tRect, 0, BitOR($RDW_INVALIDATE, $RDW_ERASE)) #ce _Gdiplus_PathReset($hPath) ;Top Button TopBtn_Path($hPath, 0, 1, $iWidth_VSCROLL - 2) $aRegion[0] = _GDIPlus_RegionCreateFromPath($hPath) _Gdiplus_GraphicsFillPath($hGfx_Bmp, $hPath) ;The Curve part _Gdiplus_PathReset($hPath) ;Bottom Button TopBtn_Path($hPath, 0, $iHeight - $iWidth_VSCROLL + 1, $iWidth_VSCROLL - 2) _PathRotate($hPath, 180) $aRegion[1] = _GDIPlus_RegionCreateFromPath($hPath) _Gdiplus_GraphicsFillPath($hGfx_Bmp, $hPath) _Gdiplus_PathReset($hPath) ;Thumb ThumbBtn_Path($hPath, 0, $iWidth_VSCROLL - 2 + $iThumb_Y, $iThumb_Height, $iWidth_VSCROLL - 2) $aRegion[2] = _GDIPlus_RegionCreateFromPath($hPath) _Gdiplus_GraphicsFillPath($hGfx_Bmp, $hPath) ;Draw something more $iSide = $iWidth / 2 - 2 _GDIPlus_GraphicsDrawArc($hGfx_Bmp, $iWidth / 2 - $iSide, $iWidth_VSCROLL - 2 + $iThumb_Y + $iThumb_Height / 2 - $iSide, 2 * $iSide, 2 * $iSide, 51, 180, $hPen) $iSide = $iWidth / 3 - 2 _GDIPlus_GraphicsDrawArc($hGfx_Bmp, $iWidth / 2 - $iSide, $iWidth_VSCROLL - 2 + $iThumb_Y + $iThumb_Height / 2 - $iSide, 2 * $iSide, 2 * $iSide, 230, 110, $hPen) ;Arrows $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0) $aInfo = _GDIPlus_GraphicsMeasureString($hGfx_Bmp, ChrW(217), $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGfx_Bmp, ChrW(217), $hFont, $aInfo[0], $hFormat, $hBrush) ;Up Arrow $tLayout = _GDIPlus_RectFCreate(0, $iHeight - ($iWidth_VSCROLL - 2) / 2, 0, 0) $aInfo = _GDIPlus_GraphicsMeasureString($hGfx_Bmp, ChrW(218), $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGfx_Bmp, ChrW(218), $hFont, $aInfo[0], $hFormat, $hBrush) ;Down Arrow ;Draw the image on the GUI $hHbmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) ;Mem Release _GDIPlus_FontDispose($hFont) _GDIPlus_GraphicsDispose($hGfx_Bmp) _GDIPlus_ImageDispose($hBmp) Return $hHbmp EndFunc ;==>hHbmp_ScrollButtons_And_Track #cs Func hHbmp_ScrollThumb($iWidth, $iHeight, $iBkColor, ByRef $aRegion, $iThumb_Y, $iThumb_Height) _Gdiplus_PathReset($hPath) ;Thumb ThumbBtn_Path($hPath, 0, $iWidth_VSCROLL - 2 + $iThumb_Y, $iThumb_Height, $iWidth_VSCROLL - 2) $aRegion[2] = _GDIPlus_RegionCreateFromPath($hPath) _Gdiplus_GraphicsFillPath($hGfx_Bmp, $hPath) ;Draw something more $iSide = $iWidth / 2 - 2 _GDIPlus_GraphicsDrawArc($hGfx_Bmp, $iWidth / 2 - $iSide, $iWidth_VSCROLL - 2 + $iThumb_Y + $iThumb_Height / 2 - $iSide, 2 * $iSide, 2 * $iSide, 51, 180, $hPen) $iSide = $iWidth / 3 - 2 _GDIPlus_GraphicsDrawArc($hGfx_Bmp, $iWidth / 2 - $iSide, $iWidth_VSCROLL - 2 + $iThumb_Y + $iThumb_Height / 2 - $iSide, 2 * $iSide, 2 * $iSide, 230, 110, $hPen) EndFunc ;==>hHbmp_ScrollThumb #ce Func SetInRange(ByRef $iVar, $iMin, $iMax) $iVar = _Iif($iVar < $iMin, $iMin, $iVar) $iVar = _Iif($iVar > $iMax, $iMax, $iVar) EndFunc ;==>SetInRange Func Return_CLientRect($hWnd, $iX = -1, $iY = -1, $iWidth = -1, $iHeight = -1) $tRect = DllStructCreate($tagRECT) If $iX = -1 And $iY = -1 And $iWidth = -1 And $iHeight = -1 Then DllStructSetData($tRect, 1, _WinAPI_GetClientWidth($hWnd) + 2) DllStructSetData($tRect, 2, 2) DllStructSetData($tRect, 3, _WinAPI_GetWindowWidth($hWnd) - 2) DllStructSetData($tRect, 4, _WinAPI_GetClientHeight($hWnd)) Else DllStructSetData($tRect, 1, $iX) DllStructSetData($tRect, 2, $iY) DllStructSetData($tRect, 3, $iX + $iWidth) DllStructSetData($tRect, 4, $iY + $iHeight) EndIf Return $tRect EndFunc ;==>Return_CLientRect Func GetCurLineIndex($hEdit) $aSel = _GUICtrlEdit_GetSel($hEdit) If $aSel[0] = $aSel[1] Then Return _GUICtrlEdit_LineFromChar($hEdit) Else _GUICtrlEdit_SetSel($hEdit, -1, -1) $iRet = _GUICtrlEdit_LineFromChar($hEdit) _GUICtrlEdit_SetSel($hEdit, $aSel[0], $aSel[1]) Return $iRet EndIf EndFunc ;==>GetCurLineIndex ;Thanks to Guinness - http://www.autoitscript.com/forum/topic/125684-guictrlgetbkcolor-get-the-background-color-of-a-control/ Func GUICtrlGetBkColor($hWnd, $iX = 0, $iY = 0) ;Modified - PXL If IsHWnd($hWnd) = 0 Then $hWnd = GUICtrlGetHandle($hWnd) Local $hDC = _WinAPI_GetDC($hWnd) Local $iColor = _WinAPI_GetPixel($hDC, $iX, $iY) _WinAPI_ReleaseDC($hWnd, $hDC) Return $iColor EndFunc ;==>GUICtrlGetBkColor ;Thanks to UEZ - http://www.autoitscript.com/forum/topic/150160-solved-gdi-path-transform-rotate/#entry1072071 Func _PathRotate($hPath, $iAngle) ;Modified - PXL $aBounds = _GdiPLus_PathGetWorldBounds($hPath) $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $aBounds[0] + $aBounds[2] / 2, $aBounds[1] + $aBounds[3] / 2) _GDIPlus_MatrixRotate($hMatrix, $iAngle) _GDIPlus_MatrixTranslate($hMatrix, -($aBounds[0] + $aBounds[2] / 2), -($aBounds[1] + $aBounds[3] / 2)) _GDIPlus_PathTransform($hPath, $hMatrix) _GDIPlus_MatrixDispose($hMatrix) EndFunc ;==>_PathRotate Func GetLineHeight($hEdit) ; Create DC $hDC = _WinAPI_GetDC($hEdit) $hFont = _SendMessage($hEdit, $WM_GETFONT) ; $WM_GetFont $hPrev_Font = _WinAPI_SelectObject($hDC, $hFont) Local $tSize = DllStructCreate("int;int") DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hDC, "wstr", "¤", "int", 1, "ptr", DllStructGetPtr($tSize)) _WinAPI_SelectObject($hDC, $hPrev_Font) _WinAPI_ReleaseDC($hEdit, $hDC) Return DllStructGetData($tSize, 2) EndFunc ;==>GetLineHeight Func MapWindowPoints($hWndFrom, $hWndTo, $lpPoints, $cPoints) $aRet = DllCall("user32.dll", "int", "MapWindowPoints", "hwnd", $hWndFrom, "hwnd", $hWndTo, "ptr", $lpPoints, "int", $cPoints) If @error Or $aRet[0] = 0 Then Return SetError(@error, 0, -1) Return $aRet[0] EndFunc ;==>MapWindowPoints Test #include <CScrollBar.au3> ;What ever name you give to the UDF $hGui = GUICreate("Paths", 400, 400, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX) Local $String For $i = 1 To 50 ;No. of lines For $j = Random(33, 127, 1) To Random(33, 127, 1) ;No of chars in a line $String &= Chr($j) Next $String &= @CRLF Next GUICtrlCreateEdit($String, 5, 5, 200, 300, BitOR($ES_WANTRETURN, $ES_AUTOVSCROLL)) Startup_CustomScrollBar(GUICtrlGetHandle(-1)) GUISetState() Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Shutdown_CustomScrollBar() Exit EndSwitch Until 0 The CPU consumed upon moving the thumb is approx 12-18. So is it much enough to stop this project in Autoit. I just want some reviews and what users think about this script. The above is just implemented with Vertical Scrollbar. Thanks for you time
  23. Rich-Edit Predict Text UDF Working It sub classes the rich-edit control and matches the current word through the Database & sets selection in accordance. For Edit Controls look Functions Predicts Text from an User-Defined Database.Sets the Predicted Text when Enter is pressed.Pressing Backspace deletes the previously typed character.Support Editing, Overwriting, Updating, Deleting the Database.Has the Feature to add New words the user types in the control, to the Database.Supports Sensitive and In-Sensitive Prediction.Currently Supports Auto-completion only.Rich Edit Controls only supportedFuture Updates​Support Auto-suggestion.Note That if you set a Password Char for the Edit Box the Prediction will automatically get Unregistered.This UDF requires Beta Release 3.3.9.4++ [beta-Oct-2012] Index ; #CURRENT# ===================================================================================================================== ;_RegisterPrediction ;_UpdatePredictList ;_UnRegisterPrediction ;_RegisterListingSpaceWords ;_RegisterListingNewWords ;_GetSelectedText ;_GetListCount ;_GetCurrentWord ;_GetCaretOffset ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ;_New_WndProc ; AddToArray ; MakeArray ;_RichEdit_SubClass ;_AutoExit ;_PredictText ;_PredictSpaceText ;_SetSelection ;_MatchString ;_CtrlSetStyle ;_CtrlGetStyle ;_RemoveBit ; =============================================================================================================================== Please Notify for any other Updates and Bugs. Change-log v1.0 - First Release v1.1 - Fixed a bug. RichEditPredictText [uDF] v1.1 v1.1 RichEditPredictText UDF.7z Previous Downloads : 80 Regards Phoenix XL
  24. Let me explain better.And Im 100% sure many have this problem and would be awesome if there would be a fix for this . So : In the SciTE script editor, if I load a big project, I want my source code to be clean, good ordered and concise. Because I have many functions, I often tight or expand them via that left little '+' or '-' cube button of the function. But after I close the SciTE window, ofc my sourcecode gets saved but not and the functions state ! Everytime I start the project , I start with all the functions expanded, despite if they were tightened or expanded . What could I do to SciTE to save my code state too ?
  25. Hi, I retrieved the style and ex-style in hex format of and input control, however I don't want to have "magic numbers" in my script so I would like to have them in the constants format. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Local Const $hGUI = GUICreate("MyGUI") GUICtrlCreateEdit("transparent and borderless edit", 10, 10, 280, 20, _ BitOR($WS_VISIBLE, $WS_CHILD, $ES_LEFT, $ES_READONLY, $ES_AUTOHSCROLL), _ 0x00000004) GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) WEnd GUIDelete($hGUI) As you can see I could not find what the ex-style "0x00000004" is, which seems to be "NOBORDER". Thanks for any help. Br, FireFox.
×
×
  • Create New...