kurtykurtyboy Posted April 26, 2023 Author Posted April 26, 2023 (edited) Here is me playing with an upcoming feature - drawing graphic controls. This turned out to be more formidable than I had anticipated, but I think it ended up working out nicely. Edited April 26, 2023 by kurtykurtyboy Musashi, Skeletor, ioa747 and 1 other 4
winkot Posted May 1, 2023 Posted May 1, 2023 I suggest changing the menu. Instead of "Import from au3", use "Open from au3". Instead of "Export to au3" use "Save as au3". So it will be much clearer.
kurtykurtyboy Posted May 3, 2023 Author Posted May 3, 2023 @winkot I certainly understand your point. However, the open/close functions refer to working with the native agd files. So au3 files would be working with external files not necessarily created by GuiBuilder Plus. That's the reason for the "Import/Export" language. I'll think about it.
kurtykurtyboy Posted May 4, 2023 Author Posted May 4, 2023 A substantial update is now available, so check the first post. The list of changes is quite long, so I won't add them here. Just check the first post. Musashi, pixelsearch and argumentum 3
pixelsearch Posted May 4, 2023 Posted May 4, 2023 There's a possible GUI improvement in GuiBuilderPlus_formGenerateCode.au3 In this GUI ($hFormGenerateCode) there's a RichEdit control ($editCodeGeneration) which doesn't resize when we resize the GUI (which has a $WS_SIZEBOX style)@melba23 indicated in this post a way to do it (I tried it just now on your script and it works fine) As this GUI has only a Close button (no Maximize or Restore Buttons) then Melba23's script should work fine. In case one day you want to apply it to a GUI having also Maximize and Restore Buttons, then there is a 2nd Melba23's script, on same web page, which shows how to do it (as simply as his 1st script) Great job kurtykurtyboy kurtykurtyboy and Musashi 1 1
kurtykurtyboy Posted May 4, 2023 Author Posted May 4, 2023 @pixelsearch Thanks for reporting and the tip for fixing it. Your proposed solution seems to work well. Fixed for the next release! Skeletor 1
Skeletor Posted May 5, 2023 Posted May 5, 2023 @kurtykurtyboy - Keep going with this project and never give up. I am seriously hoping this project continues and evolves into the Main GUI Builder for AutoIt.. Just like how @water made all those MS Office UDF which has been an absolutely, excellent addition to this language.   Musashi and argumentum 2 Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI
winkot Posted May 5, 2023 Posted May 5, 2023 Why is the main function used? And without it, everything works.
Skeletor Posted May 5, 2023 Posted May 5, 2023 Ok so I looked into this because I want this project to gain momentum. There is still alot to do.  Firstly, I was playing around with adding in some new icons. Im going to create some flat icons and some 3D type icons. Other ideas from the community are welcome. I want to also know if these can be standardized to 32 X 32? Here is a base icon view: The other thing is, do you @kurtykurtyboy have a modified copy of the GuiEdit.au3? Because mine did not have _GUICtrlEdit_SetPadding. So I had to create this function in order for it to startup. The other issue I found was in the Resh file, I caught this error:  error: _GUICtrlRichEdit_GetTextLength() called with wrong number of args. So just to fix it I deleted this , 0 and it worked. ; #FUNCTION# ==================================================================================================================== ; Author ........: Chris Haslam (c.haslam) ; Modified.......: kurtykurtyboy ; =============================================================================================================================== Func _GUICtrlRichEdit_GotoCharPosNoFocus($hWnd, $iCharPos) If $iCharPos > _GUICtrlRichEdit_GetTextLength($hWnd, True, True) Then Return SetError(103, 0, False) _GUICtrlRichEdit_SetSelNoFocus($hWnd, $iCharPos, $iCharPos) If @error Then Return SetError(@error, 0, False) Return True EndFunc ;==>_GUICtrlRichEdit_GotoCharPos  Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI
Skeletor Posted May 5, 2023 Posted May 5, 2023 (edited) I've picked up one other thing. When I try to create two rectangles, the first which is blue, disappears. Edited May 5, 2023 by Skeletor Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI
pixelsearch Posted May 5, 2023 Posted May 5, 2023 kurtykurtyboy scripted everything with AutoIt 3.3.16.0 (as indicated at line #6 of GuiBuilderPlus.au3) @skeletor You're probably using an old version of AutoIt, that's why _GUICtrlEdit_SetPadding() is missing and _GUICtrlRichEdit_GetTextLength() got less parameters than the new AutoIt versions. Instead of patching your old version of AutoIt, why not installing the latest stable version 3.3.16.1 dated september 2022 ? Musashi 1
kurtykurtyboy Posted May 5, 2023 Author Posted May 5, 2023 @winkot Are you referring to the "_main()" function? You're right, it's not absolutely required. But I like to make sure to encapsulate each piece of code in a function to minimize the amount of code that is just hanging out there in the ether.
kurtykurtyboy Posted May 5, 2023 Author Posted May 5, 2023 @Skeletor I'm excited that others are interested in this project! Your icons look nice. I'm open to giving them a refresh. Let me know what you come up with. @pixelsearch is correct. It looks like _GUICtrlEdit_SetPadding was added in the latest version 3.3.16.0. But the RESH UDF was last updated in 2013! 5 hours ago, Skeletor said: When I try to create two rectangles, the first which is blue, disappears. This is something that I have experienced but only occasionally, and I have not been able to do it on command. Are you seeing this every time or just randomly? If I could recreate it, then I can try fixing it. Skeletor 1
pixelsearch Posted May 5, 2023 Posted May 5, 2023 @kurtykurtyboy it's true that "RESH.au3" version 3.1 scripted by @beege was released on Dec 24, 2013 But don't forget the fact that you added 3 new functions in your customized version of RESH, which are : _GUICtrlRichEdit_SetSelNoFocus _GUICtrlRichEdit_AppendTextNoFocus _GUICtrlRichEdit_GotoCharPosNoFocus You probably copied the 3 basic functions from "GuiRichEdit.au3" version 3.3.16.0 (where they exist without "NoFocus" in their names) then reworked them to reach your goal. That's why some code found in _GUICtrlRichEdit_GotoCharPosNoFocus is not compatible with older versions of AutoIt (for example 3.3.15.4 from 2018) because of : _GUICtrlRichEdit_GetTextLength($hWnd, True, True, 0) This function had only 3 parameters in AutoIt 3.3.15.4 , that makes it incompatible with anyone running GuiBuilderPlus while using AutoIt 3.3.15.4 (2018) or less. Anyway, imho we're spending too much time on this point. To avoid these so-called issues, everyone should update his AutoIt version with the last stable version, which is actually 3.3.16.1 dated September 2022 Musashi and argumentum 2
pixelsearch Posted May 6, 2023 Posted May 6, 2023 (edited) @kurtykurtyboy I tried to modify the Tabs spacing in the RichEdit control, dividing each Tab spacing by 2 . The pic in your very 1st post shows how it appears on your computer (one Tab taking the space of 8 characters) . In the pic below, 1 Tab takes the space of 4 characters (it's still a Tab character of course, not 4 spaces characters) You probably tried it too, because of your commented line _GUICtrlEdit_SetTabStops(...) in GuiBuilderPlus_codeGeneration.au3 , which btw returns in your case an @error = -1 (documented in the function, unfortunately not in the help file) It wasn't really easy to do it (at least for me) because it required also some change in RESH. Not sure if it's important or not, you'll decide Edited May 6, 2023 by pixelsearch
kurtykurtyboy Posted May 6, 2023 Author Posted May 6, 2023 @pixelsearch You're right, I briefly looked at shrinking the tab size when it was still a regular edit control. I haven't tried yet with the rich edit. I would be interested in seeing your solution if you got it to work.
pixelsearch Posted May 7, 2023 Posted May 7, 2023 (edited) @kurtykurtyboy ok I'll try to explain in a long post what I did yesterday to shrink the Tabs size : 1) in a regular edit control 2) in a RichEdit control containing plain text 3) in a RichEdit control containing RTF text (as found in GuiBuilderPlus) First of all there are 2 functions found in AutoIt, to set Tab Stops in edit controls : _GUICtrlEdit_SetTabStops (for regular edit control) _GUICtrlRichEdit_SetTabStops (for Richedit control) _GUICtrlEdit_SetTabStops was scripted by Gary Frost in 2007 in this post and its 2nd parameter must be an Array of Tab stops On the contrary, _GUICtrlRichEdit_SetTabStops 2nd parameter can't be an Array and must be an integer or a string. imho both functions could have been combined into one, making it easier to use, especially they're both based on the same EM_SETTABSTOPS message. Here is what we read on msdn concerning this message : The EM_SETTABSTOPS message sets the tab stops in a multiline edit control. When text is copied to the control, any tab character in the text causes space to be generated up to the next tab stop. This message is processed only by multiline edit controls. You can send this message to either an edit control or a rich edit control. In the following scripts, I won't use these 2 functions but a personal function named _SetTabStops() which contains only 2 lines (and a lot of comments inside it, comments that will be deleted after the 1st script)1) Here is the 1st script concerning a regular edit control :expandcollapse popup #include <GuiEdit.au3> #include <GUIConstantsEx.au3> #include <SendMessage.au3> Example() Func Example() Local $hGUI = GUICreate("Edit Set Tab Stops", 500, 300) Local $idEdit = GUICtrlCreateEdit("", 1, 1, 498, 298) GUICtrlSetFont(-1, 11, 400, 0, "Lucida Console") ; An array as 2nd parameter would work fine when used with _GUICtrlEdit_SetTabStops ; Local $aTabStops[1] = [14] ; _GUICtrlEdit_SetTabStops($idEdit, $aTabStops) _SetTabStops($idEdit, 14) ; 14 corresponds approx. to 4 characters width (as my Scite) in this Standard Edit control with this font GUISetState() ; placed here after 5 Tabs on purpose (for testing horizontal position) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example ;================================================================= Func _SetTabStops($hWnd, $iTabStops) ; personal, based on simplified _GUICtrlEdit_SetTabStops() and _GUICtrlRichEdit_SetTabStops, with an integer as 2nd parameter. ; See also discussion on https://www.autoitscript.com/forum/topic/51587-tab-size-in-edit/ ; msdn : EM_SETTABSTOPS message : ; The EM_SETTABSTOPS message sets the tab stops in a multiline edit control. When text is copied to the control, any tab character ; in the text causes space to be generated up to the next tab stop. ; This message is processed only by multiline edit controls. You can send this message to either an edit control or a rich edit control. If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) ; Next line _SendMessage based on _GUICtrlEdit_SetTabStops / _GUICtrlRichEdit_SetTabStops, with "uint*" instead of "struct*" of course. _SendMessage($hWnd, $EM_SETTABSTOPS, 1, $iTabStops, 0, "wparam", "uint*") EndFunc ;==>_SetTabStops See the good result on my computer ? The GuiSetState() line starts on purpose with 5 Tabs in my Scite window, the alignment is correct with the content of the Edit control.2) Here is the 2nd script concerning a RichEdit control containing plain textexpandcollapse popup #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> ; for _WinAPI_CreateFont #include <WinAPIGdiInternals.au3> ; ditto Example() Func Example() Local $hGUI = GUICreate("RichEdit Set Tab Stops", 500, 300) Local $hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 1, 1, 498, 298, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_HSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $ES_NOHIDESEL)) ; horizontal scrollbar ; Nine's - https://www.autoitscript.com/forum/topic/206070-setup-permanent-font-for-richedit-control/?do=findComment&comment=1484072 Local $hFont = _WinAPI_CreateFont(14, 0, 0, 0, $FW_NORMAL, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Lucida Console') ; trying to match Standard Edit control having font 11 Lucida Console _SendMessage($hRichEdit, $WM_SETFONT, $hFont, True) ; True = the control redraws itself _WinAPI_DeleteObject($hFont) ; An array as 2nd parameter generates an error when used with _GUICtrlRichEdit_SetTabStops ; Local $aTabStops[1] = [14] ; _GUICtrlRichEdit_SetTabStops($hRichEdit, $aTabStops) ; ConsoleWrite("@error = " & @error & @crlf) ; 1021 _SetTabStops($hRichEdit, 14) ; 14 corresponds approx. to 4 characters width (as my Scite) in this RichEdit control with this font GUISetState() ; placed here after 5 Tabs on purpose (for testing horizontal position) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) EndFunc ;==>Example ;================================================================= Func _SetTabStops($hWnd, $iTabStops) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) _SendMessage($hWnd, $EM_SETTABSTOPS, 1, $iTabStops, 0, "wparam", "uint*") EndFunc ;==>_SetTabStops Good result again, this time it was in a RichEdit control containing plain text3) The 3rd script concerns a RichEdit control containing RTF text (GuiBuilderPlus) * First the code concerning "GuiBuilderPlus_formGenerateCode.au3" (e.g. 1 line _SetTabStops + Func _SetTabStops) ... $editCodeGeneration = _GUICtrlRichEdit_Create($hFormGenerateCode, "", 10, 10, $w - 20, $h - $titleBarHeight - 78, BitOR($ES_MULTILINE, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL)) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlSetFont(-1, 9, -1, -1, "Courier New") _SetTabStops($editCodeGeneration, 22) ; 22 corresponds approx. to 4 characters width (as my Scite) in this RichEdit control with this font _RESH_SyntaxHighlight($editCodeGeneration, 0, _code_generation()) ... ;================================================================= Func _SetTabStops($hWnd, $iTabStops) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) _SendMessage($hWnd, $EM_SETTABSTOPS, 1, $iTabStops, 0, "wparam", "uint*") EndFunc ;==>_SetTabStops * Then the code concerning your customized version of "RESH.au3" . Here is the reworked function __RESH_HeaderFooter with a header containing 32 Tab Stops : Func __RESH_HeaderFooter(ByRef $sCode) Local $iFirstTab = 412, $sTabPos = "" ; 413 would be acceptable too For $i = 1 To 32 ; $MAX_TAB_STOPS = 32 (let's add them all in case of severe indentation) $sTabPos &= "\tx" & ($iFirstTab * $i) ; "\tx412\tx824\tx1236\..." Next #Tidy_Off $sCode = "{" & _ "\rtf1\ansi\ansicpg1252\deff0\deflang1033" & _ "{" & _ "\fonttbl" & _ "{" & _ "\f0\fnil\fcharset0 " & $g_RESH_sFont & ";" & _ "}" & _ "}" & _ "{" & _ "\colortbl;" & _ $g_RESH_sColorTable & _ "}" & _ "{" & _ "\*\generator Msftedit 5.41.21.2510;" & _ "}" & _ "\viewkind4\uc1\pard" & $sTabPos & _ "\f0\fs" & $g_RESH_iFontSize & " " & _ StringStripWS($sCode, 2) & "\par" & _ "}" #Tidy_On EndFunc ;==>__RESH_HeaderFooter The result can be found in the pic of my preceding post ("Live Generated Code") which shows the shrinked Tabs size. If applied it also to Beege's original "RESH.au3", here is the result when using his example, after I added for fun 1 Tab per line (going from 1 Tab to 10) : Note: instead of these 32 \tx...\tx...\tx... I wish I could have added this : \deftabn Default tab width (720) But I couldn't make it. If anyone knows how and where to place \deftab in a RTF file, please share your knowledge, thanks ! Hope it helps Edited May 7, 2023 by pixelsearch changed tab width to 412 (instead of 415) Musashi 1
kurtykurtyboy Posted May 7, 2023 Author Posted May 7, 2023 (edited) @pixelsearch great investigation work! Your "\tx" loop solution seems to be the best (and only) solution right now. The \deftabn property was my first thought as well. I believe it goes here in the header: \rtf1\ansi\ansicpg1252\deff0\deflang1033\deftab414 However, I was also unable to get this to work. Strangely though, if I paste the following into an RTF file using notepad then open it with Microsoft WordPad, it follows the deftab as expected. If you create another file with the exact same content but remove the \deftab414, the tabs are larger as expected. This suggests that the concept and method are sound, but there is something with the AutoIt implementation of the RichEdit control that does not follow/support the \deftab property. {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deftab414{\fonttbl{\f0\fnil\fcharset0 Courier New;}} {\colortbl ;\red0\green0\blue255;\red255\green0\blue0;\red0\green0\blue144;\red240\green0\blue255;\red172\green0\blue169;\red170\green0\blue0;\red0\green153\blue51;} {\*\generator Riched20 10.0.19041}\viewkind4\uc1 \pard\cf1\f0\fs18 Func\cf0 _main\cf2 ()\cf0\par \tab _guiCreate\cf2 ()\cf0\par \tab\cf3 GUISetState\cf2 (\cf4 @SW_SHOWNORMAL\cf2 )\cf0\par \par \tab\cf1 While\cf0 \cf5 1\cf0\par \tab\tab\cf1 Switch\cf0 \cf3 GUIGetMsg\cf2 ()\cf0\par \tab\tab\tab\cf1 Case\cf0 \cf6 $GUI_EVENT_CLOSE\cf0\par \tab\tab\tab\tab\cf1 ExitLoop\cf0\par \par \tab\tab\tab\cf1 Case\cf0 \cf1 Else\cf0\par \tab\tab\tab\tab\cf7 ;\par \cf0\tab\tab\cf1 EndSwitch\cf0\par \tab\cf1 WEnd\cf0\par \cf1 EndFunc\cf0\par } Â Edited May 7, 2023 by kurtykurtyboy pixelsearch 1
winkot Posted May 7, 2023 Posted May 7, 2023 (edited) On 5/5/2023 at 10:14 PM, kurtykurtyboy said: But I like to make sure to encapsulate each piece of code in a function to minimize the amount of code that is just hanging out there in the ether. I understand you. But if this is a public program for everyone I think it would be nice if it could create standard scripts, without regard to individual preferences. The one that Koda does, for example. Edited May 7, 2023 by winkot
mLipok Posted May 7, 2023 Posted May 7, 2023 Why not to use scite lexer dll ? argumentum 1 Signature beginning:* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *  My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"  , be   and    \\//_. Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
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