kcvinu Posted June 9, 2023 Share Posted June 9, 2023 Hi all, I am happy to introduce my latest AutoIt hobby project. Glance. It is a gui library created with windows api functions. Back end of this library is a dll file created in Nim programming language. So you have to place the dll near to your exe. Here is a screenshot. Please see the image. And here is the sample code for the window in the image. expandcollapse popup#AutoIt3Wrapper_UseX64=y #include "glance.au3" Local $frm = glf_NewForm("My Autoit window in Nim", 1100, 500) ; Create new Form aka Window glf_FormCreateHwnd($frm) ; Create the form's handle Local $mbar = glf_FormAddMenuBar($frm, "File|Edit|Help") ; Create a menubar for this form glf_FormAddMenuItems($frm, "File", "New Job|Remove Job|Exit") ; Add some sub menus for 'File' & 'Edit' menus glf_FormAddMenuItems($frm, "Edit", "Format|Font") glf_FormAddMenuItems($frm, "New Job", "Basic Job|Intermediate Job|Review Job") ; Add some submenus to 'New Job' glf_MainMenuAddHandler($frm, "Basic Job", $gMenuEvents.onClick, "menuClick"); Add an event handler for 'Basic Job' Local $btn1 = glf_NewButton($frm, "Normal", 15) ; Now create some buttons Local $btn2 = glf_NewButton($frm, "Flat", 127) Local $btn3 = glf_NewButton($frm, "Gradient", 240) glf_ControlSetProperty($btn2, $gControlProps.backColor, 0x90be6d) ; Set back color property glf_ButtonSetGradient($btn3, 0xf9c74f, 0xf3722c) ; make this button gradient glf_ControlAddHandler($btn1, $gControlEvents.onClick, "onBtnClick") ; Add an event handler for btn1 Local $cal = glf_NewCalendar($frm, 15, 70) ; A simple calendar control. Local $cb1 = glf_NewCheckBox($frm, "Compress", 40, 280) ; Create two checkboxes Local $cb2 = glf_NewCheckBox($frm, "Extract", 40, 310) glf_ControlSetProperty($cb2, $gControlProps.foreColor, 0xad2831) ; Set the checked property to True Local $cmb = glf_NewComboBox($frm, 350, 25) ; Create new ComboBox glf_ComboAddRange($cmb, "Windows|Linux|Mac|ReactOS") ; Add some items. You can use an array also glf_ControlSetProperty($cmb, $gControlProps.backColor, 0x68d8d6) ; Set the back color Local $dtp = glf_NewDateTimePicker($frm, 350, 72) ; Create new DateTimePicker aka DTP Local $gb = glf_NewGroupBox($frm, "My Groupbox", 25, 245, 150, 100) ; Create new GroupBox glf_ControlSetProperty($gb, $gControlProps.foreColor, 0x1a659e) ; Set the fore color Local $lbl = glf_NewLabel($frm, "Static Label", 260, 370) ; Create a Label glf_ControlSetProperty($lbl, $gControlProps.foreColor, 0x008000) ; Set the fore color Local $lbx = glf_NewListBox($frm, 500, 25) ; Create a ListBox glf_ListBoxAddRange($lbx, "Windows|Linux|Mac OS|ReactOS") ; Add some items glf_ControlSetProperty($lbx, $gControlProps.backColor, 0xffc2d4); Set the back color Local $lv = glf_NewListView($frm, 270, 161, 330, 150) ; Create a ListView glf_ListViewSetHeaderFont($lv, "Gabriola", 18) ; Set header font glf_ControlSetProperty($lv, $gListViewProps.headerHeight, 32) ; Set header height glf_ControlSetProperty($lv, $gListViewProps.headerBackColor, 0x2ec4b6) ; Set header back color glf_ControlSetProperty($lv, $gControlProps.backColor, 0xadb5bd) ; Set list view back color glf_ListViewAddColumns($lv, "Windows|Linux|Mac OS", "0") ; Add three columns glf_ListViewAddRow($lv, "Win 8|Mint|OSx Cheetah") ; Add few rows glf_ListViewAddRow($lv, "Win 10|Ubuntu|OSx Catalina") glf_ListViewAddRow($lv, "Win 11|Kali|OSx Ventura") Local $cmenu = glf_ControlSetContextMenu($lv, "Forums|General|GUI Help|Dev Help") ; Add a context menu to list view Local $np1 = glf_NewNumberPicker($frm, 385, 114) ; Create two new NumberPicker aka Updown control Local $np2 = glf_NewNumberPicker($frm, 300, 114) glf_ControlSetProperty($np2, $gNumberPickerProps.buttonLeft, True) ; Set the buttons position to left. Default is right glf_ControlSetProperty($np2, $gControlProps.backColor, 0xeeef20) ; Set back color glf_ControlSetProperty($np2, $gNumberPickerProps.decimalDigits, 2) ; Set the decimal precision to two glf_ControlSetProperty($np2, $gNumberPickerProps.stepp, 0.25) ; Set the step value to 0.25 Local $pgb = glf_NewProgressBar($frm, 25, 363) ; Create a progressbar glf_ControlCreateHwnd($pgb) glf_ControlSetProperty($pgb, $gProgressBarProps.value, 30) ; Set the value to 30% glf_ControlSetProperty($pgb, $gProgressBarProps.showPercentage, True) ; We can show the percentage in digits Local $rb1 = glf_NewRadioButton($frm, "Compiled", 655, 25) ; Create new RadioButtons Local $rb2 = glf_NewRadioButton($frm, "Interpreted", 655, 55) glf_ControlSetProperty($rb1, $gRadioButtonProps.checked, True) ; Set one of them checked Local $tb = glf_NewTextBox($frm, "Some text", 270, 326, 150) ; Create a new TextBox glf_ControlSetProperty($tb, $gControlProps.foreColor, 0xd80032) ; Set the foreColor Local $tkb1 = glf_NewTrackBar($frm, 760, 351) ; Create new TrackBars Local $tkb2 = glf_NewTrackBar($frm, 540, 351) glf_ControlSetProperty($tkb1, $gTrackBarProps.customDraw, True) ; If set to True, we can change lot of aesthetic effects glf_ControlSetProperty($tkb2, $gTrackBarProps.customDraw, True) glf_ControlSetProperty($tkb1, $gTrackBarProps.showSelRange, True) ; We can see the selection are in different color. glf_ControlSetProperty($tkb2, $gTrackBarProps.ticColor, 0xff1654) ; Set tic color ; glf_ControlSetProperty($tkb2, $gTrackBarProps.channelColor, 0x006d77) ; Set channel color. Local $tv = glf_NewTreeView($frm, 760, 25, 0, 300) ; Create new TreeView glf_ControlSetProperty($tv, $gControlProps.backColor, 0xa3b18a) ; Set back color glf_ControlCreateHwnd($tv) glf_TreeViewAddNodes($tv, "Windows|Linux1|MacOS|ReactOS" ) ; Add some nodes glf_TreeViewAddChildNodes($tv, 0, "Win 7|Win 8|Win 10|Win 11") ; Add some child nodes glf_TreeViewAddChildNodes($tv, 1, "Mint|Ubuntu|Red Hat|Kali") glf_TreeViewAddChildNodes($tv, 2, "OSx Cheetah|OSx Leopard|OSx Catalina|OSx Ventura") func onBtnClick($c, $e) ; $c = sender of this event aka, the button itself. $e = EventArgs, like in .NET print("Calendar view mode", glf_ControlGetProperty($cb1, $gControlProps.width)) EndFunc func menuClick($m, $e) ; Here $m is menu itself. $e is MenuEventArgs print("Menu clicked", $m) EndFunc glf_FormShow($frm.ptr) ; All set, just show the form You can get the files from my git repo. Here is the link https://github.com/kcvinker/Glance.git Danyfirex, TheDcoder, argumentum and 1 other 4 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
UEZ Posted June 9, 2023 Share Posted June 9, 2023 Looks nice. Why do you used an external DLL for this? I'm also interested in the NIM source. 🙂 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
kcvinu Posted June 9, 2023 Author Share Posted June 9, 2023 (edited) @UEZ, Thank you. I have already written a GUI library in Nim. If I don't use an external DLL, then data grouping is a problem AutoIt. More over, I can complete this project by making small changes to the existing UI library I wrote in Nim. Only about 250 more lines of code needed to be added. Of course I will push glance.dll's source code to the repo. Edited June 9, 2023 by kcvinu UEZ 1 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
UEZ Posted June 9, 2023 Share Posted June 9, 2023 Thanks - got the NIM source code now. Why did you not post it in the Example section? Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
TheDcoder Posted June 9, 2023 Share Posted June 9, 2023 Yes I agree with @UEZ, this should be posted in the Examples section. @kcvinu Thanks for making an alternative GUI sub-system, I'm sure this will come in handy to someone By the way, do coloured buttons work in your GUIs? AutoIt GUIs have a critical bug which is currently labelled as "won't fix" due to the amount of complexity involved, coloured buttons don't work properly. EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
kcvinu Posted June 9, 2023 Author Share Posted June 9, 2023 (edited) @UEZ, Oops ! My bad. I didn't think about the examples forum. Sorry for that. @TheDcoder, Thank you. What do you mean 'buttons don't work properly.` ? AFAIK, my button's are working perfectly. The only single issue I faced was the round corner drawing in win11 and square corner drawing in win10. But that's trivial. Edited June 9, 2023 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
kcvinu Posted June 9, 2023 Author Share Posted June 9, 2023 @TheDcoder, The colored button drawing is not that complex even with AUtoIt's own DllCall feature & win api functions. Before writing this Glance library, I have started one with pure autoit code using DllCall. In that project, I created a window & button successfully. The button had colors too. But I dropped that project because of heavy usage of your map. It is a value type we need to keep two maps. One for the user and one for the internal book keeping. That will end up in a heavy bloat code base. So I dropped that and used my nim gui lib "NimForm"'s code. TheDcoder 1 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
argumentum Posted June 9, 2023 Share Posted June 9, 2023 (edited) ..interesting. Thanks. I use a dark theme. Will your code allow to change these colors ? Edited June 9, 2023 by argumentum removed the pic. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
kcvinu Posted June 9, 2023 Author Share Posted June 9, 2023 (edited) @argumentum, Thanks for testing. Sadly, I didn't wrote anything related to handle dark theme. There are certain things which you can't change. Calendar back color is one of them. But you can change form's back color to a dark one. Anyhow, I am interested to see the whole window image. I am curious about the flat color button showed in black color. But the same time, gradient button is showing perfect colors. Edit: @argumentum, Now I see your code $frm.backColor = 0x... This will not work. You need to use the glf_ControlSetProperty($frm, 0x...) Edited June 9, 2023 by kcvinu argumentum 1 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
kcvinu Posted June 9, 2023 Author Share Posted June 9, 2023 @argumentum Sorry, there is a mistake in my last comment. You should use glf_ControlSetProperty($frm, $gControlProps.backColor, 0x...) argumentum 1 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
argumentum Posted June 9, 2023 Share Posted June 9, 2023 (edited) The background color does not change the canvas, just the background on the controls ( to green 0x00FF00 ) Edited June 9, 2023 by argumentum removed the pic. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
kcvinu Posted June 9, 2023 Author Share Posted June 9, 2023 (edited) @argumentum, Thank you for the image. It seems that the WM_ERASEBKGND is not working as intended in dark themed systems. Edit: The gray color is the window class's color. Edited June 9, 2023 by kcvinu argumentum 1 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
argumentum Posted June 9, 2023 Share Posted June 9, 2023 it crashes AutoIt ( rc:-1073741819 ) in some Win10 versions but I can not identify which and why. Are there any dependencies that we need to be aware of ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
kcvinu Posted June 9, 2023 Author Share Posted June 9, 2023 (edited) @argumentum There are no dependencies except the glance dll. But you can do one thing to spot the problem. Just comment out some code and run. Do that until you found trouble causing line. Just comment out all the control creation code. Run with a bare form. If there is no problem, run with some buttons. If it is okay, run with checkboxes. Thus, you can spot the problem. I don't have access to win 10 now. Edited June 9, 2023 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
argumentum Posted June 9, 2023 Share Posted June 9, 2023 2 hours ago, kcvinu said: ... Thus, you can spot the problem. Local $mbar = glf_FormAddMenuBar($frm, "File|Edit|Help") ; Create a menubar for this form <<<<<<<< this is the one Func glf_FormAddMenuBar(ByRef $frmMap, $baseMenus) Local $mbar = DllCall($hDll, "ptr", "newMenuBarPtr", "ptr", $frmMap.ptr, "wstr", $baseMenus) if @error Then $frmMap.error = @error EndFunc Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
kcvinu Posted June 9, 2023 Author Share Posted June 9, 2023 @argumentum Thank you. I will check this soon and let you know. argumentum 1 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Andreik Posted June 10, 2023 Share Posted June 10, 2023 It looks good but I managed to crash the app multiple times just by clicking things. Here are two examples of errors: Quote X: 487 Y: 119 MM_NOTIFY_REFLECT TREEVIEW MM_NOTIFY_REFLECT TREEVIEW MM_NOTIFY_REFLECT TREEVIEW !>03:16:01 AutoIt3.exe ended.rc:-1073740771 Quote MM_NOTIFY_REFLECT TREEVIEW MM_NOTIFY_REFLECT TREEVIEW MM_NOTIFY_REFLECT TREEVIEW virtualFree failing! When the words fail... music speaks. Link to comment Share on other sites More sharing options...
kcvinu Posted June 10, 2023 Author Share Posted June 10, 2023 (edited) @Andreik Thank you for testing this. Error noted. Let me check. Edit: @Andreik Applied a temporary fix on that issue. Will work on that later. You can download the latest version of dll from github. Edited June 10, 2023 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Andreik Posted June 10, 2023 Share Posted June 10, 2023 (edited) Still get some crashes in some conditions: Quote X: 552 Y: 326 X: 490 Y: 106 X: 443 Y: 69 !>05:29:28 AutoIt3.exe ended.rc:-1073740771 Quote X: 416 Y: 107 X: 299 Y: 124 X: 325 Y: 357 virtualFree failing! Edited June 10, 2023 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
kcvinu Posted June 10, 2023 Author Share Posted June 10, 2023 @argumentum Problem found and a temporary fix applied. You can test it with downloading the dll again from my repo. I just pushed it now. argumentum 1 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) 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