chriss85 / cgui Goto Github PK
View Code? Open in Web Editor NEWAn object-oriented GUI library for AutoHotkey
An object-oriented GUI library for AutoHotkey
Also make sure that link conversion works properly!!
Regression bug. Haven't been able to find it yet. For some reason TTHwnd isn't created properly.
When I #include CGUI, it somehow changes the include dir, so that future includes have to be specified with an absolute path. For example, this is my setup:
main ahk script:
#include src\somefile.ahk
#include src\ui.ahk
#include src\someotherfile.ahk
ui.ahk:
#include <CGUI>
Now, when I run the main script, I get an error:
#Include file "src\someotherfile.ahk" cannot be opened.
If I change the main script to
#include src\somefile.ahk
#include src\ui.ahk
#include %A_ScriptDir%\src\someotherfile.ahk
or
#include %A_ScriptDir%\src\somefile.ahk
#include %A_ScriptDir%\src\ui.ahk
#include %A_ScriptDir%\src\someotherfile.ahk
then everything works as expected. I'm not sure what's causing this, but is there any way to stop this behavior?
Thanks
Edit:
Adding #include %A_ScriptDir%
after the CGUI include also works to reset my include dir to its original value.
Useful for settings pages and similar scenarios. Controls are hidden/shown when the specific item is selected.
This is already implemented for CTreeViewControl and CChoiceControl, left to do are CListViewControl and CCheckboxControl
No idea why, perhaps show should check for this and correct it?
The problem is that some controls are assigned to other controls and aren't currently accessible through the main form.
2 guis used to come on simultaneously.
Broken in commit 029bae7
It would be better if one could specify a custom event handler for a control or if the first handler would be used automatically (if the others aren't present maybe).
It would also be good to provide a method to find the selected radio button from any button in the group.
It might be nice to support subclassing controls. Implementation might be similar to CGUI.OnMessage.
It might also be necessary to do this anyway because of the different message numbers for SETFOCUS/KILLFOCUS messages.
Much to do here.
The geometry of the GUI (x,y,width,height) does not seem to be handled correctly. I tested with width and height (not with x and y yet) and do have following observations/remarks/bugs ...
Base Code from your CSharpGuiConverter.ahk:
001: Class CSharpGuiConverter Extends CGUI
002: {
003: label1 := this.AddControl("Text", "label1", "x12 y15 w53 h13", "Input File:")
004: txtInput := this.AddControl("Edit", "txtInput", "x71 y14 w274 h20", "")
005: btnInput := this.AddControl("Button", "btnInput", "x351 y12 w36 h23", "...")
006: label2 := this.AddControl("Text", "label2", "x12 y41 w61 h13", "Output File:")
007: txtOutput := this.AddControl("Edit", "txtOutput", "x71 y40 w274 h20", "")
008: btnOutput := this.AddControl("Button", "btnOutput", "x351 y38 w36 h23", "...")
009: btnConvert := this.AddControl("Button", "btnConvert", "x15 y66 w120 h23", "Convert")
010: btnRun := this.AddControl("Button", "btnRun", "x141 y66 w120 h23", "Run Converted File")
011: btnEdit := this.AddControl("Button", "btnEdit", "x267 y66 w120 h23", "Edit Converted File")
012: __New()
013: {
014: IniRead, in, %A_ScriptName%.ini,Settings, In, %A_Space%
015: IniRead, out, %A_ScriptName%.ini,Settings, Out, %A_Space%
016:
017: this.txtInput.Text := in
018: this.txtOutput.Text := out
019:
020: this.btnConvert.Enabled := FileExist(in) && strlen(out) > 1
021: this.btnRun.Enabled := 0
022: this.btnEdit.Enabled := 0
023:
024: MsgBox % this.x " - " this.y " - " this.Width " - " this.Height
XXX: ; Output: 0 - 0 - 0 - <MISSING>
025: this.height := 116
026: this.Title := "C# GUI Converter"
027: this.Width := 401
028: MsgBox % this.x " - " this.y " - " this.Width " - " this.Height
XXX: ; Output: 0 - 0 - 401 - 116
029: this.DestroyOnClose := true
030: this.Show()
031: }
1.) Initialization (Line 024)
TestResult: MsgBox shows " 0 - 0 - 0 - "
2.) What are/should be the impacts of setting this.width (or height or x or y)?
2.a.) If width is not set by user (Omitting line 025): As the GUI contains already some controls (Line 002 ... Line 011) the GUI does have some default width (which seems to be correct - as the GUI is drawn to show all added controls). In this case this.width should be set to the "default value" (I would call it "calculated width") ...
2.b.) What should be the behaviour if this.width is set explictly? Should the size of the drawn GUI be "setted.width" - or "calculated width"? I think it has to be "setted.width" - which isn't the case yet. (Change line 027 to "this.Width := 801" and run the example - the drawn GUI has the same size as before, "this.Width" is unconsidered .... -> this seems to be a bug)
Coming back to 1.) this.Width should not show up as "0" in line 024 - better it should show up as "calculated width"
3.) this.width should always have a valid value. I would like to do something like this:
(Nonsense example in context of example above - but demonstrates what I mean (for example: Placing a button in the lower left corner of GUI, width over the whole GUI)
024a: margin := 20
024b: this.btnEdit.x := margin
024c: this.btnEdit.y := this.height - margin
024d: this.btnEdit.width := this.width - 2*margin
BTW: as the GUI uses some default margin, it would be nice to have a Getter() for this value ... ;-) ( a Setter() would also be nice)
=> Summary:
Calling ModifyCol() on a listview control does not resize all columns, and if you specify a column number it deletes the column title and doesn't resize its contents.
Not quite sure whether this is an issue or NOOB error, but nevertheless:
I cannot figure out how to update the contents of the StatusBar:
MyWindow := new CBasicWindow("Demo") ;Create an instance of this window class
Loop 100
{
MyWindow.SetProgress(A_Index, 100)
sleep 50
}
Class CBasicWindow Extends CGUI
{
;...
statBar := this.AddControl("StatusBar", "statBar", "", "test")
progBar := this.AddControl("Progress", "progBar", "", "Progress")
;...
__New(Title)
{
;...
this.statBar.Parts := [{Text : "Percent done: ", Width : floor(this.width*0.5), Icon := A_AhkPath
}, {Text : "Hello World!"}]
this.Show();
;...
}
SetProgress(value, total = 100)
{
percent := floor(value/total * 100)
this.progBar.Value := percent ; this updates progressbar as desired ...
this.statBar.Parts[1] := {text : "Percent done: " percent} ; THIS DOES NOT WORK
}
}
I tried out several things, but cannot figure out, how to update contents of Statusbar .... (either bug or - as I said - NOOB ...)
Relative coordinates might also be useful for tabs.
Your latest changes (after Commit:9cf3a96dbc879f5e851209358dd0798aea8c7a20) are breaking example ProgressBar.ahk (https://github.com/ChrisS85/CGUI_Examples/blob/master/ProgressBar.ahk)
Could not yet figure out why ...
Make menu classes that allow callbacks in the gui class.
Add a validate callback function for edit controls and possibly others. The function should return a valid string or the original one if it is acceptable.
As you stated here in AHK-Forum setting of icons of menuItems does not work as expected and is obviously an error:
mnu := New CMenu("mnu")
mnu.AddMenuItem("item", "cbItem")
; Don't know whether this is correct syntax - but I tried a lot variants, and none worked
mnu.item.SetIcon("test.ico") ; does not work
mnu.item.Icon := "test.ico" ;does also not work
Content isn't saved/shown.
Width, height, maybe bits per pixel.
Some ideas to speed things up a little:
The ListView control needs some speedup (I'd say somewhere around a factor of 2-10) with handling its items. I did some stuff there previously but it's still bad.
It could be possible that references to base objects don't really go to the base but to the control object itself, since another layer object is added on top.
Some ListView g-label calls may be missed because they appear too shortly in sequence. It's probably better to implement an event queue with a timer, possibly for all controls to be safe.
Setting properties for progressbar should be either be
The current behaviour of progressbar with not working makes it very difficult to find out the error source... (as NO hint is given yet)
This issue is a followup of #46
Right now message handlers need to locate the instance by the window handle they were sent to. This library should feature a OnGUIMessage(Message, Function) method that enables message handling of this message and forwards it to GUI.Function.
This is a suggested change because the current behavior doesn't allow to use | in texts, while `n doesn't seem to be used where delimiters are. This is a compatibility breaking change so it needs to be considered thoroughly.
Following issue with ListView:
I've got a single column Listview.
Class CBasicWindow Extends CGUI
{
;...
lvItems := this.AddControl("ListView", "lvItems", "", "TITLE:")
;...
__New(data)
{
;...
this.lvItems.ModifyCol(1,floor(this.lvItems.Width * 0.995),"")
this.lvItems.Items.Clear()
Loop, parse, data, `n
{
this.lvItems.Items.Add("",A_LoopField)
}
this.Show("")
;...
}
This results in following output Image
Issues are best illustrated, looking at the image:
Conclusion:
In the documentation, properties are referred to as "variables." I think it would be more accurate to refer to them as properties, since they really aren't variables.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.