[Library] TAB v0.1 (Preview) - Add Functionality to the Tab Control

Post your working scripts, libraries and tools
jballi
Posts: 488
Joined: 29 Sep 2013, 17:34

[Library] TAB v0.1 (Preview) - Add Functionality to the Tab Control

17 Jun 2018, 16:22

Introduction
The TAB library was created to add functionality to AutoHotkey-created tab controls.

TAB library
Key features:
  • Icons. Add a unique icon for each tab.
  • Tooltips. Add a unique tooltip for each tab. A tooltip title can also be set.
  • Display Area. Easily identify the position and size of the tab control's display area. Useful when positioning controls at the display area boundaries (Ex: Group box).
Screenshots

The Code
The pertinent files are as follows:Compatibility
This library is designed to work on all versions of AutoHotkey v1.1+: ANSI, Unicode, and Unicode x64.

Issues/Considerations
A few considerations:
  • Preview. This version of the project has been marked as Preview because it's the first release and because it has never been tested on anything other Windows 7. If you experience any problems, please let me know.
  • Examples. This project includes quite a few examples. If any of the examples don't work as expected, please let me know. I will try to correct the problem.
  • Other Issues/Considerations. See the "Issues and Considerations" section in the library documentation for more information.
Release Notes
Helgef
Posts: 3033
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Library] TAB v0.1 (Preview) - Add Functionality to the Tab Control

18 Jun 2018, 03:47

Really nice work :shock: :bravo: .

I tried most of the examples, seems to work very well, excellent job. Great documentation too.

Thank you very much for sharing, cheers.
DigiDon
Posts: 172
Joined: 19 May 2014, 04:55
Contact:

Re: [Library] TAB v0.1 (Preview) - Add Functionality to the Tab Control

18 Jun 2018, 03:51

I was just about to post nearly similar thing :lol: .

Well done jballi, great work :clap:

I also tried with no problem but I'm like you also on Win 7 - 64 bits ;)
EverFastAccess : Take Notes on anything the Fast way: Attach notes, Set reminders & Speed up research in 1 gesture - AHK topic
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad. (Miles Kington)
User avatar
Klark92
Posts: 147
Joined: 18 Jan 2015, 19:33

Re: [Library] TAB v0.1 (Preview) - Add Functionality to the Tab Control

24 Jun 2018, 06:34

thanks, very useful for ahk
Smart Kombo 1.0 | One of the best Knight Online's key combo program...
freakkk
Posts: 8
Joined: 21 Sep 2014, 20:14

Re: [Library] TAB v0.1 (Preview) - Add Functionality to the Tab Control

28 Jun 2018, 00:18

jballi, this is an excellent library! AND the documentation is amazing! Did you use NaturalDocs to generate your html help file by chance?

I definitely plan to use this for a couple of the styles that you demonstrated. The "No Tabs" example highlights a good way of using the tabcontrol as more of a panel type control.

Have you considered starting a GitHub account to host your source on, rather than using dropBox links?
jballi
Posts: 488
Joined: 29 Sep 2013, 17:34

Re: [Library] TAB v0.1 (Preview) - Add Functionality to the Tab Control

28 Jun 2018, 02:13

Thanks for the feedback everybody. I hope that someone finds it useful.

freakkk wrote:Did you use NaturalDocs to generate your html help file by chance?

Yes. You can tell because there is a link to the NaturalDocs web site at the bottom right of every one of the HTML documents that they generate.

I'm still using a old version of NaturalDocs. I was going to say that it's the latest version but I noticed that a new version was released last month. And no, I haven't tried it yet.

freakkk wrote:Have you considered starting a GitHub account to host your source on, rather than using dropBox links?

I have always intended to migrate to GitHub but I've never gotten around to it. Most of the projects I release include example scripts that include other libraries/functions and sometimes other files (icons, pictures, text files, etc.) that are required in order for them to run. I haven't figured out a good way to publish something like that from GitHub.

Thank you for your interest and your feedback.
User avatar
evilC
Posts: 4235
Joined: 27 Feb 2014, 12:30

Re: [Library] TAB v0.1 (Preview) - Add Functionality to the Tab Control

30 Jun 2018, 10:08

Looks really great, but IMHO this would be even slicker if done using classes.

As an example, I had a go at converting TAB.ahk to a class, and Example - Tabs Only.ahk to use that class.
I am not sure I converted everything perfectly, but hopefully this gives you some food for thought:

Code: [Select all] [Expand] [Download] (Example - Tabs Only.ahk)GeSHi © Codebox Plus



ClassTabs library - packaged it as a class, and added __New() constructor, plus added SetHeight method.

Code: [Select all] [Expand] [Download] (ClassTabs.ahk)GeSHi © Codebox Plus

jballi
Posts: 488
Joined: 29 Sep 2013, 17:34

Re: [Library] TAB v0.1 (Preview) - Add Functionality to the Tab Control

30 Jun 2018, 19:25

evilC, thank you for your feedback.

I'm a big believer in using the right tool for the right job. If the typical GUI used 2, 3, or more tab controls at a time then I might be convinced that there is value to converting a library of functions into a class. But typically there is only one tab control in a GUI so using a class instead of a library of functions is just trading one syntax for another. Instead of calling a function, a method is used. And including the "gui Add" statement within the class is a bit clunky, especially since the library supports all 3 tab control types.

In my opinion, a class should only be created when it provides substantial value. Managing multiple instances of a class is not the only reason to use a class but it is one of the better reasons. Is using a class rather than a library of functions "slicker?" Perhaps. But all developers know how to call a function. The syntax for creating a class instance and then triggering the appropriate method when needed is not hard but it is not something that all developers understand yet.

I've seen a few developers come around to this way of thinking. They create a class because it is the latest feature of AutoHotkey and then they convert it back into a library of functions when they figure out that the class didn't add any substantial value.

This is just my opinion. Thank you for your interest.
User avatar
evilC
Posts: 4235
Joined: 27 Feb 2014, 12:30

Re: [Library] TAB v0.1 (Preview) - Add Functionality to the Tab Control

01 Jul 2018, 04:49

To make it support Tab2, Tab3 etc, you can just add a parameter to the constructor.

FindText(p_Text):

Code: [Select all] [Download] GeSHi © Codebox Plus

		;-- Initialize
VarSetCapacity(TCITEM,A_PtrSize=8 ? 40:28,0)
VarSetCapacity(l_Text,MAX_TEXT*(A_IsUnicode ? 2:1),0)
NumPut(TCIF_TEXT,TCITEM,0,"UInt") ;-- mask
NumPut(&l_Text, TCITEM,A_PtrSize=8 ? 16:12,"Ptr") ;-- pszText
NumPut(MAX_TEXT, TCITEM,A_PtrSize=8 ? 24:16,"Int") ;-- cchTextMax

This is executed once per function call, but is the same every time.
With classes, you could build the struct once in the constructor, store it as a class property, then re-use it. It would mean startup was a bit slower, but repeatedly calling FindText would be more performant. Or, if you want the best of both worlds, then store it as a dynamic property or something, so that it gets lazy initialized.

Furthermore, you can possibly eliminate the need for some DLL calls - for example if you intend for users to only set or get styles using SetStyle / GetStyle, then when SetStyle is called, you could simply store the style as a class property, then GetStyle could just return that property.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: burque505 and 12 guests