AutoHotkey Community

It is currently May 27th, 2012, 8:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 136 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10  Next
Author Message
 Post subject:
PostPosted: January 8th, 2012, 10:26 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
In terms of CGUI, I was thinking about such a cyclic structure:
GUI->EventHandler->Delegate->GUI

If you're using a separate model object it wouldn't be a problem.

But you're right, it would be possible there to simply unregister it once the window is destroyed.

I haven't investigated this, but I assume that other languages like C# might be able to resolve such cyclic references for garbage collection.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 9th, 2012, 8:04 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
A proper implementation of an Garbage Collector starts at the root objects, and travels down the linked hierarchies. Everything which is reachable this way is alive, anything other can be removed.

And off course, C# does handle this propperly. Otherwise my apps - (or better my users) would have some problems :lol:

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 18th, 2012, 1:04 pm 
Offline
User avatar

Joined: January 25th, 2006, 8:08 am
Posts: 225
Location: Froschtümpel
I'm trying to use ProgressBar - but with no success yet.... I cannot figure out how to update the progress bar value to indicate some process ...

What I tried yet:
Code:
SetBatchlines, -1
MyWindow := new CBasicWindow("Demo")
Loop 1000
{
    MyWindow.progBar.Value := A_Index
    MyWindow.Redraw() ; or: MyWindow.progBar.Redraw()
   sleep 10
}
return

#include %A_ScriptDir%\lib
#include CGUI.ahk

Class CBasicWindow Extends CGUI
{
   progBar     := this.AddControl("Progress", "progBar", "", "Progress")
   __New(Title)
   {
      ;Set some window properties
      this.Title := Title
      this.Resize := true
      this.MinSize := "200x50"
      this.CloseOnEscape := true
      this.DestroyOnClose := true
         
      this.progBar.Min := 0
      this.progBar.Max := 1000
      this.progBar.Value := 0
      this.progBar.Width := 160
      this.progBar.Style := 0x800000
      ;Show the window
      this.Show("")
   }
   
   PostDestroy()
   {
      ;Exit when all instances of this window are closed
      if(!this.Instances.MaxIndex())
         ExitApp
   }
}



ProgressBar is displayed with this code ... but nothing happens (no progress shown ...)

What's I also don't understand: Unless I've given an initial value of "0" - the displayed progress bar is displayed full colored (as if the initial value is 100% ...)

Any hints welcome ...

_________________________

Code:
;     (.)~(.)   
;    (-------)                                   
;---ooO-----Ooo---------------------------------------------------
;    Hoppfrosch  - AHK 1.1.05.06 Unicode 32bit on Win7 Ultimate
;-----------------------------------------------------------------                       
;    ( )   ( )                           
;    /|\   /|\ 


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 18th, 2012, 11:02 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
Thanks for reporting, I've pushed a fix. Please get the latest version.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2012, 7:41 am 
Offline
User avatar

Joined: January 25th, 2006, 8:08 am
Posts: 225
Location: Froschtümpel
fragman wrote:
Thanks for reporting, I've pushed a fix. Please get the latest version.

That did it ...
Thanks!


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 25th, 2012, 8:04 am 
Offline
User avatar

Joined: January 25th, 2006, 8:08 am
Posts: 225
Location: Froschtümpel
Hi,

I cannot figure out the syntax to set the icon of a menuItem:

Code:
mnu := New CMenu("mnu")
mnu.AddMenuItem("item", "cbItem")


How can I give menu Item "item" an icon? I tried several variations of SetIcon() function and manipulation of Icon property, but do not have any success yet ...

TIA
Hoppfrosch


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2012, 10:31 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
You're right, there's obviously a bug. Can you post a bug report on GitHub about it? I think the functions that add menu items should also return them.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2012, 6:18 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
I fixed a few issues (menu items, consistent client/window coordinates).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2012, 9:55 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
I committed an update to support EventHandlers and Delegates. Thanks IsNull for this!

I did not have much time to do more than the most basic tests unfortunately, so it would be nice if anyone who wants to use it could give me a notice if problems turn up.

While doing this I also needed to rename the Validate event to OnValidate.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2012, 8:32 am 
Offline
User avatar

Joined: January 25th, 2006, 8:08 am
Posts: 225
Location: Froschtümpel
fragman wrote:
..., so it would be nice if anyone who wants to use it could give me a notice if problems turn up.


As you asked for it: I submitted an issue on github already ...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2012, 6:16 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
After some testing I came to the conclusion that this is not a bug. Compare to this:
Code:
gui, add, progress, hwndhtest, 30
Control, Style, 0x800000,,% "ahk_id " htest
gui, show
The problem lies in setting that style. I'm not quire sure why it worked before, but I think I fixed a bug about setting styles some time ago.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2012, 8:56 pm 
Offline
User avatar

Joined: May 18th, 2010, 3:10 pm
Posts: 1179
Location: Sweden
Just commenting in general to say I'm glad this is still being maintained and updated - it's one of the most important libraries. Thumbs up. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2012, 8:58 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
To be honest it could really make good use of more feedback or other developers looking through it as I often find bugs in it myself while using it.

For me it's mostly a tool to be able to write GUIs in OOP-style, I don't have the drive to make it 100% perfect by running all kinds of tests on it, but I'll gladly fix any reported bugs or integrate patches.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 24th, 2012, 5:48 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
I had to make some changes to account for client and window positions/sizes properly.

It now acts like this:

x/y : Window position
width/height : Client width/height
WindowWidth/WindowHeight : Window width/height
Position : Window position
Size : Client size
WindowSize : Window size

I would like to hear some comments on this. Do you think this solution is appropriate? Is there a need to get the x and y coordinates of the client rectangle in screen coordinates?

I also added 4 conversion functions to convert points between client<->window and client<->screen.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 5th, 2012, 3:45 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
I added an Autosize() function that adapts the size of controls (mostly text controls, others may require an additional offset) to the text. This is useful if the text changes and the control needs to increase its size.

I also added the ability to supply BITMAP handles to the picture control on creation.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 136 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group