Code Monkey home page Code Monkey logo

ahk.guicls's Introduction

AutoHotkey Gui Class Version 2

Create AutoHotkey gui objects

This README is:

Under Construction

COMING SOON

I will be adding more case examples as well as links to projects built with this.

There might not be any changes to this code base; not to say I write perfect code, but if there's a better way to refactor/optimize this class then I don't know how to do it and welcome anyone to fork this and do so, but this is perfect for everything I do with GUI's in AutoHotkey and the way it works is quite clever if I do say so myself (and I do, of course :p).

The way this class works, even if there isn't a method to do everything under the sun with GUI's, it can still tie in with any normal method allowing you to just plug this framework into existing projects creating hybrids (framework/normal AHK GUI code).

Also, I plan to create an archived release of this with no artifacts for easy download accessibility and stat creation for this project.

Example

You can find an example/tutorial script in the Example Folder found at the root of this repository & there's an archive of the example here Compressed Example.

This is meant for intermediate to advanced skill level users. In order to use this class you should probably already be experienced with the AutoHotkey language & especially experienced with guis. Understanding how guis work in AutoHotkey will help you understand how to use this class & also all the things that can be done with this class.

You can find a video preview of the example/tutorial here: AutoHotkey _Gui Class Example Preview

Recent bug fixes

  • Fixed bug in getControls() method that didn't correctly get the 'focus' & 'focusv' attributes of a control.
  • Added the need to provided a Text Hwnd variable name for the custom _Gui.Button() method along with it's relative Progress Hwnd variable name.

File Types

The .aclass file is the same as the .ahk file, which can be used as an #Include; helps me separate main files from imports

Example Code getControls() ShowCase

Get a control information object

    getControls(){
        if (this.getId()) {
            WinGet,_ctrlList,ControlList,% "ahk_id " this.id
            if (_ctrlList != ""){
                loop,parse,_ctrlList,`n
                {   
                    if (! IsObject(this.controls[A_LoopField])) {
                        this.controls[A_LoopField] := {}
                    }
                    GuiControlGet   ,   content,% this.sub,%A_LoopField%
                                    ,   % ((SubStr(A_LoopField,1,6)="Button")?"Text":"")
                    GuiControlGet,pos,% this.sub "Pos",%A_LoopField%
                    GuiControlGet,focus,% this.sub "Focus"
                    GuiControlGet,focusv,% this.sub "FocusV"
                    GuiControlGet,enabled,% this.sub "Enabled",%A_LoopField%
                    GuiControlGet,visible,% this.sub "Visible",%A_LoopField%
                    GuiControlGet,hwnd,% this.sub "Hwnd",%A_LoopField%
                    GuiControlGet,name,% this.sub "Name",%A_LoopField%
                    this.controls[A_LoopField]["focus"] := focus ;
                    this.controls[A_LoopField]["focusv"] := focusv ;
                    this.controls[A_LoopField]["content"] := content ;
                    this.controls[A_LoopField]["pos"]   :=  {   "x":posX
                                                            ,   "y":posY
                                                            ,   "w":posW
                                                            ,   "h":posH} ;
                    this.controls[A_LoopField]["enabled"] := enabled ;
                    this.controls[A_LoopField]["visible"] := visible ;
                    this.controls[A_LoopField]["hwnd"] := hwnd ;
                    this.controls[A_LoopField]["name"] := name ;
                }
            }
            return this.controls
        }
    }

Motivation

I like to "objectify" things for various reasons and I really wanted a way to compartmentalize different gui windows

License

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

License provided in the License folder on the source page

Project Information

Readme Card

Description Status
Project Release Date GitHub Release Date
Total downloads for this project GitHub all releases
Complete repository size This Repo Size
Commits in last month GitHub commit activity
Commits in last year GitHub commit activity

Latest Version Status

Description Status Number of Downloads
Latest Release version Release Version GitHub release (latest by date)
Latest Tag version, possible Pre-Release's Tag Version GitHub release (latest by date)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.