Obsolete test build - Tab3 control with autosizing, SetTimer improvements

Community news and information about new or upcoming versions of AutoHotkey
just me
Posts: 9406
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: New test build - Tab3 control with autosizing, SetTimer improvements

14 Mar 2016, 07:34

lexikos wrote:These changes may break scripts.
How about a new BIV A_ThisTimer providing all kinds of timers?
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

14 Mar 2016, 09:26

Did I missed something?

Image
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
jballi
Posts: 723
Joined: 29 Sep 2013, 17:34

Re: New test build - autosizing Tab3, SetTimer improvements

14 Mar 2016, 09:54

lexikos wrote:Previously (since v1.1.01) the default value of Label was %A_ThisLabel%, even if there is no timer running or there is a timer running but it called a function. Scripts that relied on this weird behaviour will break.

If Label is omitted and the current thread was not started by a timer (or the timer has been deleted), an error is raised.
May is not the correct word. This change will break scripts. I write many of my subroutines to run as a standard subroutines and as timers. Almost all of these routines have SetTimer,,Off as the first line of the subroutine. If this change is implemented as is, I will have to change many many scripts to put back the %A_ThisLabel% or to precede the statement with the "Try" command. AutoHotkey v1.1.01 was released almost 5 years ago. This change can affect thousands if not hundreds of thousands of scripts or more. I sincerely urge you not to break scripts, especially for something that has been this way for almost 5 years.

Them be my thoughts.
lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

14 Mar 2016, 19:04

just me wrote:How about a new BIV A_ThisTimer providing all kinds of timers?
Built-in variables can only return strings.
jballi wrote:AutoHotkey v1.1.01 was released almost 5 years ago.
Damn, you're right. :shock:
This change can affect thousands if not hundreds of thousands of scripts or more.
That seems likely to be exaggerated.

I think it should be sufficient to use A_ThisLabel as before, but falling back to the current timer when A_ThisLabel is empty. Do you see any problems with this? It would mean that a timer callback function wouldn't be able to use SetTimer,,xxx to disable/modify itself from within an internal gosub subroutine/after goto, but that seems like an edge case.

@jNizM: I didn't see this on my Windows 10 system. Thanks for pointing it out (although I had difficulty seeing it even with the red ellipse; a few words of description would have been useful).
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

15 Mar 2016, 02:44

v1.1.22.06-5+gc938422 vs v1.1.23.03-13+gfc20377
Image

The right grey Tab3 "border" line is missing in the latest version.

Windows 10 Enterprise
Version: 1511
Build: 10586.164
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

15 Mar 2016, 03:33

Yes, I know. You pointed it out in your previous post, and I acknowledged it. :?

The issue is that the "tab dialog" which hosts the controls is slightly too wide, and is covering the right border. It will be fixed.
lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

15 Mar 2016, 07:13

v1.1.23.03-17+gf6a2f5e:
  • Fixed Tab3 right edge overlapping the border.
  • Changed SetTimer,, xxx to use A_ThisLabel as before, but fall back to the current timer when A_ThisLabel is empty.
User avatar
jballi
Posts: 723
Joined: 29 Sep 2013, 17:34

Re: New test build - Tab3 control with autosizing, SetTimer improvements

15 Mar 2016, 12:38

lexikos wrote:I think it should be sufficient to use A_ThisLabel as before, but falling back to the current timer when A_ThisLabel is empty. Do you see any problems with this? It would mean that a timer callback function wouldn't be able to use SetTimer,,xxx to disable/modify itself from within an internal gosub subroutine/after goto, but that seems like an edge case.
Sounds right. I will download the latest version and give it a try/see. Thanks.
just me
Posts: 9406
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: New test build - Tab3 control with autosizing, SetTimer improvements

20 Mar 2016, 06:36

lexikos wrote:
just me wrote:How about a new BIV A_ThisTimer providing all kinds of timers?
Built-in variables can only return strings.
Because they were implemented this way at times when all variables always contained strings?
lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

20 Mar 2016, 22:15

Yes. The limitation will be removed at some point, but I prefer to not make these sort of changes in the v1 code base. Aside from that, I'd prefer not to add this variable at all since it has, in my opinion, limited usefulness.

The point of SetTimer's Label being optional is merely convenience. If you have any practical need to identify the current timer from a function which serves multiple timers, you can use Bind or a class with a Call method (patterns which will also work with any other callbacks, like Gui, menu, OnMessage, etc).
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

20 May 2016, 04:36

Hey lexikos,

some new updates about your motivation to integrate Tab3 into main release?

Im still on v1.1.23.03-17+gf6a2f5e :D
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

24 May 2016, 12:04

I've wasted the whole day today unaware of the lonstanding issue in Tab regarding BackgroundTrans and ListView. Had I known about v1.1.24.00 earlier… :)
Anyway, fixing controls' background color in a themed Tab is most welcome, thank you!
I'd have two questions (one may have already been asked, haven't read this whole topic :oops: ):
- is Tab3 so different than Tab2 that it demanded its own separate control type instead of updating Tab2?
- could (only) this Tab change be easily backported to AHK Basic source, should one attempt to improve it?

And a suggestion that may be useful for many users involved with DllCalls: add a built-in variable called A_CharSize that would hold the value of a character's size according to AHK version (ANSI/Unicode). Would avoid much overhead in functions that require on-the-fly calculation of a struct size, string length and/or other operations.

I would stretch the above request to another built-in variable called simply AW that would additionally avoid calculation overhead when choosing API versions based on AHK ANSI/Unicode version (such as DllCall("FormatMessage" AW […] vs DllCall("FormatMessage" (A_IsUnicode ? "W" : "A") […] ).

They would both improve code readability and - more important - script speed, especially when such functions are called repeatedly and/or execution time is critical.
Part of my AHK work can be found here.
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

24 May 2016, 18:02

Tab vs Tab2 vs Tab3 :crazy:
A_CharSize would be nice :)
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
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

25 May 2016, 00:43

Drugwash wrote:And a suggestion that may be useful for many users involved with DllCalls: add a built-in variable called A_CharSize that would hold the value of a character's size according to AHK version (ANSI/Unicode). Would avoid much overhead in functions that require on-the-fly calculation of a struct size, string length and/or other operations.
VarSetCapacity(buf, size * (A_IsUnicode ? 2 : 1), 0) ?
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

25 May 2016, 05:58

jNizM wrote:
Drugwash wrote:And a suggestion that may be useful for many users involved with DllCalls: add a built-in variable called A_CharSize that would hold the value of a character's size according to AHK version (ANSI/Unicode). Would avoid much overhead in functions that require on-the-fly calculation of a struct size, string length and/or other operations.
VarSetCapacity(buf, size * (A_IsUnicode ? 2 : 1), 0) ?
joedf wrote:Yes that's what I usually use. :)
Sure, there are more ways to skin a cat, but why perform on each and every such call an extra calculation (the ternary comparison or anything else) when a single steady variable can readily be available? Waste of time and moreso in functions or subroutines that are being called very frequently (i.e. API wrappers). Personally I see it a bit more than simple convenience. Haven't performed any comparison tests but theoretically there should be some gain, mostly depending on each machine's capabilities.

In my scripts I've been using the global variable AW (together with others, see below) in a compact script #included at the beginning of the autoexec section which allows a better compatibility when same scripts are being run under AHK Basic and AHK 1.1+ (I'm still using Win98SE as my main machine and developing scripts on it, in case someone is wondering). Very recently I've changed the logic a bit, making the extra script a function and putting it in the lib folder; on that occasion it occured to me the creation of the A_CharSize variable which I then included into the function. It would be nice (and consistent) if AHK 1.1+ would sport those two variables by default so that anybody running my scripts on their machines under AHK 1.1+ would not even require the presence of the extra script. Better compatibility. ;)

Oh well, that's it. Here's my extra script:

Code: Select all

;================================================================
updates()
;================================================================
{
Global
w9x := A_OSType="WIN32_NT" ? FALSE : TRUE		; TRUE if system is Windows 95/98/98SE/ME
isBasic := A_AhkVersion < "1.1" ? TRUE : FALSE	; TRUE if AHK version is Basic (not of AHK_L family)
if isBasic
	{
	Ptr := "UInt"								; Cast pointer type to unsigned integer
	UPtr := "UInt"								; Cast unsigned pointer type to unsigned integer
	PtrP := "UIntP"								; Cast pointer-to-pointer type to pointer-to-uinteger
	UPtrP := "UIntP"							; Cast pointer-to-upointer type to pointer-to-uinteger
	AStr := "Str"								; Cast ANSI string type to string
	WStr := "UInt"								; Pointer to buffer of Unicode-converted string
	i := "A_PtrSize"
	if !A_PtrSize
		%i% := "4"								; Set pointer size to DWORD (32bit)
	}
i := "A_CharSize"
if !iA_CharSize
	%i% := 2**(A_IsUnicode=TRUE)				; Character size for use in structures and strings
i := "AW"
if !AW
	%i% := A_IsUnicode ? "W" : "A"				; Helper for DllCall() ANSI/Unicode API versions
VarSetCapacity(i, 0)							; Free memory
return TRUE
}
Part of my AHK work can be found here.
lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

25 May 2016, 06:26

An announcement topic for an obsolete test build is not the right place to request or discuss new features.
Drugwash wrote:- is Tab3 so different than Tab2 that it demanded its own separate control type instead of updating Tab2?
Yes. The differences are described in detail under the "Tab3 vs. Tab2 vs. Tab" heading in the GUI controls documentation.
- could (only) this Tab change be easily backported to AHK Basic source, should one attempt to improve it?
It could be done. As for how easily, I suppose it depends on the developer. The GUI code hasn't changed significantly, but there have been minor changes throughout the entire project for Unicode and x64 support.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: New test build - Tab3 control with autosizing, SetTimer improvements

25 May 2016, 06:46

lexikos wrote:An announcement topic for an obsolete test build is not the right place to request or discuss new features.
My apologies, I got a bit rusty. :oops: Actually I only wanted to express the joy of having that LV/Background issue fixed so promptly and then got carried away.
lexikos wrote:The differences are described in detail under the "Tab3 vs. Tab2 vs. Tab" heading in the GUI controls documentation.
Will look at the documentation more thoroughly, thank you.
lexikos wrote:It could be done. […] The GUI code hasn't changed significantly, but there have been minor changes throughout the entire project for Unicode and x64 support.
Unicode and x64 would be quite too much for now. The most important things I'd like to do in AHK Basic - if possible, if ever - would be synchronizing built-in variables and data types and then maybe a few important fixes/additions such as this Tab3. My C/C++ knowledge is extremely limited and first attempts failed, probably because I bit more than I could chew. :oops:

Talking about Tab3, after a prolonged testing I've noticed a visible flickering of the controls belonging to an inactive tab through the surface of the active tab. There is a ListView in one of the inactive tabs. AHK v1.1.24.0, Windows XP Pro SP4, Intel P4 1.8GHz, 576MB RAM, GeForce 5700. I wonder if anyone else noticed that. :?

Should I open a new topic in Bugs & Feature requests in regard to the suggested variables above?
Part of my AHK work can be found here.

Return to “Announcements”

Who is online

Users browsing this forum: No registered users and 17 guests