AutoGUI 2.5

Old Topics related to the original "AutoGUI" ahk script editor.
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: AutoGUI 2.0

15 Apr 2018, 23:41

joedf wrote:Haven't had the time to check but are SciTE4AHK themes compatible with this? Since, they both use SciTE, no? maybe the lexer is somewhat different from yours?
The lexer of SciTE4AHK was probably written by PhiLho, whereas the one from AutoGUI was created by RaptorX. AutoGUI uses Scintilla, not SciTE. SciTE is a text editor by the same author of Scintilla (Neil Hodgson).
kczx3 wrote:Alguimist, I vaguely recall you mentioning that you want to rewrite the lexer used in this project.
There are basically two minor bugs in the Scintilla lexer of RaptorX: 1. When using colon in the beggining of a line, which may occur in the case of a long or concatenated ternary. 2. Code folding is not working properly with some files, like Gdip_All.ahk.
kczx3 wrote:Do you also have plans to add a lexer for AHK v2 syntax? It doesn't differ too much but you could basically ignore command syntax.
I'm not into AHKv2 yet, so I don't know where exactly it may be affected by the current lexer, apart from the absence of commands, which means that they are probably compatible, as you said. Perhaps all that has to be done is to append the list of commands to the list of functions when setting the keywords.
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: AutoGUI 2.0

16 Apr 2018, 15:24

yes SciTE is a text editor utilizing Scintilla. Pardon the jargon... :/
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: AutoGUI 2.0

16 Apr 2018, 19:02

Doesn’t Scite4AHK use Scintilua for its theme?
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: AutoGUI 2.0

16 Apr 2018, 19:35

Oh goodness me, whatever... :facepalm: I just cant get it right :lol:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: AutoGUI 2.0

16 Apr 2018, 19:43

Don’t quote me on it! But Lex mentions that term here https://autohotkey.com/boards/viewtopic.php?t=42139
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: AutoGUI 2.0

16 Apr 2018, 22:51

ahh yes, it is the lua-to-scintilla interface, the term used before it became an integrated of scintilla
https://foicica.com/scintillua/README.html
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
BriHecato
Posts: 124
Joined: 18 Jul 2017, 07:17

Re: AutoGUI 2.0

21 Apr 2018, 14:34

Hello - i'm little confused.
When I'm starting new gui in WYSIWYG, placing buttons etc. code is autocompleting to changes made on form.
Now when i click to editor - form disappear.
When i change some size and position and click "show hide preview window" - it looks like before and if I even move this preview form - all code i write undo ....
Why this preview doesn't stay visible and why it's not refreshing to display code changes?
Also Snapping to grid only snap control position not size - i cant have "snap-sized" buttons.

Am I doing something wrong ? Thanks in advance.
StefOnSteroids
Posts: 77
Joined: 08 Aug 2015, 10:22

Re: AutoGUI 2.0

24 Apr 2018, 09:40

I think it only works in a one-way direction, the form creates the code, not the other way round. That's why it says

Code: Select all

; Do not edit above this line
at the bottom of the generated code.

Resizing controls on the form - yes, I agree, it would be nice to get bigger checkboxes etc by simply snap-dragging them larger, but again, I think that's not possible.

BTW, the design-window will be empty upon closing and re-opening your generated ahk-file. It you want it to reflect the code lines and draw the form accordingly, you'll have to use File > import GUI
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: AutoGUI 2.0

24 Apr 2018, 18:48

@BriHecato: see the comment of StefOnSteroids above, which is essentially the FAQ of AutoGUI.

In regard to the resizing of controls, it can be accomplished in three ways: 1. by dragging the small rectangles around the control; 2. holding Shift while dragging the control (this way the snap to grid also applies to the size); and 3. with Shift + arrow keys for 1 pixel adjustment or Ctrl + Shift + arrow keys for a higher increment.
StefOnSteroids
Posts: 77
Joined: 08 Aug 2015, 10:22

Re: AutoGUI 2.0

26 Apr 2018, 12:25

Thanks, Alguimist,
guess I should have been more precize with my resizing problem of checkboxes. The resizing of the caption and overall control area works nice and also snaps into place with the grid if desired. But the checkbox itself remains the same size as before. No matter how large the caption, the actual area where the clicking takes place - for the tickmark off or on - always has the same size. Possibly a Windows limit - I am on Win7 - or I am probably overlooking something.

Is there a way to make the checkbox itself larger? I am asking in general ahk-terms, not specifically how to do it within AutoGUI. Any method, programatically or by mouse dragging at design time, would be welcome.
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: AutoGUI 2.0

27 Apr 2018, 01:57

StefOnSteroids wrote:Is there a way to make the checkbox itself larger? I am asking in general ahk-terms, not specifically how to do it within AutoGUI. Any method, programatically or by mouse dragging at design time, would be welcome.
One way to make the checkbox icon larger is by means of custom icons for checked and unchecked states in a separate text control. Another way is to draw the checkbox with some Windows API functions. Example:

Code: Select all

#NoEnv

Global Chk1 := True
Global Chk2 := True

Gui Font, s14, Segoe UI
Gui Add, Text, hWndhChk1 vChk1 gCheck x10 y10 w32 h32
Gui Add, Text, x50 y12 w200 h23, Label 1
Gui Add, Text, hWndhChk2 vChk2 gCheck x10 y54 w32 h32
Gui Add, Text, x50 y56 w200 h23, Label 2
Gui Show, w481 h381, DrawFrameControl Test

DrawCheckBox(hChk1, Chk1)
DrawCheckBox(hChk2, Chk2)
Return

GuiEscape:
GuiClose:
    ExitApp

Check:
    %A_GuiControl% := !%A_GuiControl%
    GuiControlGet hWnd, hWnd, %A_GuiControl%
    DrawCheckBox(hWnd, %A_GuiControl%)
Return

DrawCheckBox(hWnd, Checked := True) {
    hDC := DllCall("GetDC", "Ptr", hWnd, "Ptr")

    VarSetCapacity(RECT, 16, 0)
    NumPut(0, RECT, 0, "Int")
    NumPut(0, RECT, 4, "Int")
    NumPut(32, RECT, 8, "Int")
    NumPut(32, RECT, 12, "Int")

    DllCall("DrawFrameControl", "Ptr", hDC, "Ptr", &RECT, "UInt", 4, "UInt", Checked ? 0x400 : 0)
}
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: AutoGUI 2.0

27 Apr 2018, 03:51

You forgot to release the device context inside the function. ;)
While DrawFrameControl() may integrate well in a standard Win9x environment with its classic look, in a themed system it will stand out, and not in a positive way. First solution may be better.
There is a third solution: usage of a Wingdings font:

Code: Select all

#NoEnv

Global Chk1 := True
Global Chk2 := True
Global Chk3 := False

Gui Font, s14, Segoe UI
Gui Add, Text, hWndhChk1 vChk1 gCheck x10 y10 w32 h32
Gui Add, Text, x50 y12 w200 h23, Label 1
Gui Add, Text, hWndhChk2 vChk2 gCheck x10 y54 w32 h32
Gui Add, Text, x50 y56 w200 h23, Label 2
Gui, Font, s28 c0xFF0000 w400, Wingdings
Gui, Add, Text, x10 y+10 w32 h32 +0x200 Center +BackgroundTrans hwndhChk3 vChk3 gToggleChk, ű
Gui, Font, s14 cDefault, Segoe UI
Gui Add, Text, x+8 yp w200 hp 0x200 vLChk3 gToggleChk, Label 3
Gui Show, w481 h381, DrawFrameControl Test

DrawCheckBox(hChk1, Chk1)
DrawCheckBox(hChk2, Chk2)
Return

GuiEscape:
GuiClose:
    ExitApp

Check:
    %A_GuiControl% := !%A_GuiControl%
    GuiControlGet hWnd, hWnd, %A_GuiControl%
    DrawCheckBox(hWnd, %A_GuiControl%)
Return

DrawCheckBox(hWnd, Checked := True) {
    hDC := DllCall("GetDC", "Ptr", hWnd, "Ptr")

    VarSetCapacity(RECT, 16, 0)
    NumPut(0, RECT, 0, "Int")
    NumPut(0, RECT, 4, "Int")
    NumPut(32, RECT, 8, "Int")
    NumPut(32, RECT, 12, "Int")

    DllCall("DrawFrameControl", "Ptr", hDC, "Ptr", &RECT, "UInt", 4, "UInt", Checked ? 0x400 : 0)
    DllCall("ReleaseDC", "Ptr", hWnd, "Ptr", hDC)
}

ToggleChk:
ctrl := InStr(A_GuiControl, "L") ? SubStr(A_GuiControl, 2) : A_GuiControl
%ctrl% := !%ctrl%
Gui, Font, % "s28 " (%ctrl% ? "c0x0000FF" : "c0xFF0000") " w400", Wingdings
GuiControl, Font, %ctrl%
GuiControl,, %ctrl%, % (%ctrl% ? "ü" : "ű")
Gui, Font
return
Part of my AHK work can be found here.
StefOnSteroids
Posts: 77
Joined: 08 Aug 2015, 10:22

Re: AutoGUI 2.0

27 Apr 2018, 10:10

Wow, very impressive, and exactly what I had hoped for. You guys are awesome.
I am still in the process of figuring out how you did it, what parameters I need to tweak to change the box-size of the drawing version (approach No 2) - although not necessary, the current size is perfect.

Best of all, it's all set to go. The variables contain the correct state of the checkboxes - checked or unchecked - which still baffles me a bit, but that's another story, having to do with the different variable names referring to the same variable nevertheless (vChk1 vs Chk1, hChk1 vs hWndhChk1)

I also like the Wingdings solution a lot (approach No 3)
1) Is it safe to asssume that Wingdings will be present on all Windows machines?
2) Should I keep switching between Wingdings and Segoe (checkbox-symbol and Label) when setting up the GUI - or is it better in terms of speed and performance when I first let it draw all Labels, THEN switch to Wingdings and add all the checkboxes from that code line downwards? I have about 20 checkboxes on that form.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: AutoGUI 2.0

27 Apr 2018, 11:50

Regarding solution 3:
1. The Wingdings font is present from Windows 95 to at least Windows 7; I don't have newer Windows versions to check but hopefully someone here will fill in that missing information.
2. Fastest way remains your choice; depending on the capabilities of the destination machine(s) there may be no significant difference.

The Help manual will explain how variables and handles are declared in a Gui, Add command; that will eliminate the confusion you're having.
Please note that Alguimist's solution doesn't appear to redraw the checkbox controls in all situations, so you may end up with blank spaces in your GUI until clicking them (which would change their states). It also doesn't change states on clicking the text labels (that can be fixed following the logic in solution 3).
Part of my AHK work can be found here.
StefOnSteroids
Posts: 77
Joined: 08 Aug 2015, 10:22

Re: AutoGUI 2.0

27 Apr 2018, 12:59

Thanks again, Drugwash,
I'll go with the Wingdings solution, the font offers nice symbols to create different-looking checkmarks.
Yes, I noticed your implementation of clicking the text labels themselves, which comes in handy, too, because my form has some lengthy labels/ captions - makes it easy for the user to click onto applicable words while reading them, instead of having to aim for the checkbox-area. Yet another benefit in terms of usability.

My apologies for cluttering this subforum with something not directly related to AutoGUI or Editors per se. Maybe someone can move it to a more appropriate subforum where users are more likely to find it, should they have similar problems. I bet there must be others out there who find the built-in checkboxes way too small for today's high resolution displays.
User avatar
megnatar
Posts: 92
Joined: 27 Oct 2014, 20:49
Location: The Netherlands
Contact:

Re: AutoGUI 2.0

06 May 2018, 04:32

Alguimist,

Thanks for developing this great IDE for ahk!! Up until a week ago I was still using SciTe.

I also have a question about syntax and keyword colouring when I start a new line with code.
() = 1 ? "" : ""

When I compare something like, reset both variables if either one or both of them is empty or do something else.

Code: Select all

(!varA || !varB) = 1 ? (VarA := 1, VarB := "VarA") : ("DoSomethigElse")
MsgBox,,, % "varA: " varA "`nvarB: " %varB%, 2
The IDE marks all lines below the comparison as Strings. I believe that is because a opening "{" is expected.
I know the manual says the syntax is var := () = 1 ? "" : "" but here I don't need something to return to
a variable, I just need to "do something else" when two variables have some value or set them when they don't.
If my syntax is valid code, and it seems it is because it never failed me, than can this please be fixed?

Greets,
Megnatar

ps: I like the dark theme. It's easy on the eyes!
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: AutoGUI 2.0

09 May 2018, 12:22

I'm checking the Scintilla AHK lexer written by RaptorX, but I couldn't yet determine what is wrong. The lexer behaves as if an expression starting with an opening parenthesis in the beginning of the line is an option of a continuation section, like LTrim. Then, when a new line is entered, and while a closing parenthesis is not typed, it behaves as if the rest of the code is the content of a continuation section.

What you can do to avoid this syntax coloring issue, as a workaround, is to evaluate the expression to a variable so that the variable can be used as the condition without the need for parentheses. Or you can simply use a regular if-else block.
User avatar
megnatar
Posts: 92
Joined: 27 Oct 2014, 20:49
Location: The Netherlands
Contact:

Re: AutoGUI 2.0

12 May 2018, 12:33

Oke! I'll just work around this with my new written scripts. Thanks 4 the replay!
User avatar
BriHecato
Posts: 124
Joined: 18 Jul 2017, 07:17

Re: AutoGUI 2.0

12 May 2018, 14:57

Alguimist wrote:@BriHecato: see the comment of StefOnSteroids above, which is essentially the FAQ of AutoGUI.

In regard to the resizing of controls, it can be accomplished in three ways: 1. by dragging the small rectangles around the control; 2. holding Shift while dragging the control (this way the snap to grid also applies to the size); and 3. with Shift + arrow keys for 1 pixel adjustment or Ctrl + Shift + arrow keys for a higher increment.
I've learned something, thanks.
Hope you improve further your tool in near future.
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: AutoGUI 2.0

24 May 2018, 18:19

Version 2.2.6:
- Minor bug fixes
- Updated help file (old style sidebar)

:arrow: Download

Return to “Old Topics”

Who is online

Users browsing this forum: No registered users and 7 guests