Giter Site home page Giter Site logo

cgui's People

Contributors

chriss85 avatar infogulch avatar uberi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cgui's Issues

Fix ListView missing g-labels

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.

Objectify menu

Make menu classes that allow callbacks in the gui class.

Assigning controls to list/tree entries

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

Setting properties for progressbar

Setting properties for progressbar should be either be

  • allowed
  • or properly disabled (error or hint in case of being set by mistake ...)

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

#Include dir changed

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.

Custom event names

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.

Optimization ideas

Some ideas to speed things up a little:

  • Replace all uses of Control.ClassNN with Control.hwnd to avoid __Get() invocation. This works fine now with the latest AHK_L.
  • Possibly remove some proxy objects. More speed against less safety against accidental overwriting of control/window properties.
  • Store references to the control/window instead of manually acquiring them each time. To make sure that there are no issues with cyclic dependencies which can apparently cause problems with releasing objects from memory and to help with object releasing in general, ObjRelease() should be called for each reference and at each access it needs to check for the validity of the reference. I believe this will be faster than the current way, but it would need to be measured.

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.

Generic mechanism to assign message handlers to GUI instances

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.

Statusbar: Updating 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 ...)

Validate callback for Edit controls

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.

GUI-geometry?

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 - "

  • this.Height is unititialized - whereas this.x, this.y, this.Width are initialized to zero

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:

  • Geometric properties of GUI should be considered correctly (see 2.b) -
  • They always should contain the current width of the GUI (see 1/2.a)

Tooltips not working

Regression bug. Haven't been able to find it yet. For some reason TTHwnd isn't created properly.

Icons of menuItems

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

Support subclassing?

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.

Documentation "variables" -> "properties"

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.

ListView issues: LeftBorder

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:

  • The border on the left side of my listview items seems to big in my personal opinion (green line in my image): the items should start right on the left border of the listview ...
  • Unless I've explicitly given a title for the column (lvItems := this.AddControl("ListView", "lvItems", "", "TITLE:")), the title is not shown! Omitting this.lvItems.ModifyCol(1,floor(this.lvItems.Width * 0.995),"") the title is shown, but the column takes only a part of the width of the complete Listview. Modifying the column with a certain width brings the column to the desired width, but the title does not show up anymore ....

Conclusion:

  • First column should start right on the left border of listview
  • Title should show up correctly after modifying the Column width
  • The initial column width of all columns should spawn the complete width of the ListView (for example with two columns each column should initially take 50% of the complete width (and not a fixed width - as it probably does now ...))

Change GUI delimiter from | to `n

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.

listview.ModifyCol auto resize

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.

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.