AutoHotkey Community

It is currently May 27th, 2012, 9:32 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 172 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 12  Next
Author Message
 Post subject:
PostPosted: August 28th, 2006, 10:41 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Thanks.
I looked at your homepage and blog too. Very nice. I like the navigation. Is that difficult to set up and maintain?

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 28th, 2006, 11:36 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
Thanks. Maintaining my site is very easy thanks to Dreamweaver :)
Creating it was sort of difficult. This was because I had to think of a layout, create the CSS styles and images, write a few php and javascript files, cross test between browsers (which made me understand why IE is so disliked by webmasters) and do a little Apache hacking all whilst conforming to the XHTML 1.0 Strict rules. Feel free to copy or use any resources from my site 8)

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2006, 12:54 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
Although I've been downloading versions of Anchor as they were released, I've never had much use for it -- my GUI's were fairly simple, I've would just write my own sizing code.

Anyway, I started working on a new GUI with a lot more controls on it so I thought I would give Anchor another try/see. Let me just say that the latest version of Anchor is kick-ass!! :!: :D

Thanks for sharing! 8)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 18th, 2006, 9:10 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
First of all, kick-ass function. See post above.

I ran into a problem/situation with Anchor that I thought I would share. I have a small app that creates a pop-up window to collect information based on dynamic data. Although the object names may remain the same, the starting X and Y positions of an object will change from time to time. The first time the window is created, everything is all good but the 2nd and subsequent times the window is created, Anchor uses some of the object specifications from the first time the window was created and... I think you see the problem.

To solve my problem, I first thought of using a new GUI number every time the pop-up is created but I would eventually run out of window numbers if the application were run for a long time.

The best (?) approach I came up to fix the problem is to get Anchor to remove the records for a particular GUI on request. I created code to solve my problem by deleting the GUI records when it finds an object name equal to "$Delete$". For example:
Code:
Anchor("$Delete$","")

Here's the code (added to the very top of the function):
Code:
;-- GUI exist?
if not A_GUI
    return

;-- Delete records for the current GUI?
if ctrl=$Delete$
    {
    ;-- Rebuild pos
    tpos:=pos
    pos=
    loop parse,tpos,`n
        {
        ;-- Empty record?
        if A_LoopField is Space
            continue

        ;-- Keep this one?
        if instr(A_LoopField,A_GUI . ":")<>1
            pos:=pos . "`n" . A_LoopField
        }

    return
    }

Using this approach, the target GUI must be "active" so the best time to execute the code would be just before/after the GUI is destroyed. For example:
Code:
GUIClose:
Anchor("$Delete$","")
gui Destroy
return

A similar approach to the one above is to use another Anchor function parameter to pass the target GUI window number. Something like the following:
Code:
Anchor("$Delete$","23")

This approach allows the developer to remove the target GUI records even if the GUI is not currently active.


These are just a few ideas. I'm hoping that you'll give it some thought and come up with a final solution that will work for everybody.

Them be my thoughts...


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 26th, 2006, 7:03 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
In version 3.4 I replaced a lot of the string commands with a single regex and reduced the amount of calculations which should make it work faster.

jballi wrote:
The best (?) approach I came up to fix the problem is to get Anchor to remove the records for a particular GUI on request.
Seems like a good idea, I'll try to work on something for the next version.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2006, 4:06 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Thanks for the update. Very clever. It took me a while to understand.
The only improvement I could see is to avoid the "i" in the last loop by using "A_index" all the time.

I see that your code gets each time Anchor() is called the factors from the string a by RegExMatch. I tried to modify the code to get the factors only at first call and store them in the pos string. But it doesn't seem to improve speed (It is fast anyway). Have you made measurements?

For each control a lot of data is stored, even if it is only resized in e.g. "w". Do you see any way to store only the data needed e.g. for "w" in pos and operate only on this data later. It might shrink the memory/length of pos and speed up.

Since we know the number of items we need from the pos string. It might be possible to use RegExMatch for this as well, instead of StringMin and StringSplit.

Just my 2 €cent.

Thanks again for this great function.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2006, 4:15 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
On jballis idea:
I think the best approach is to specify "delete" for the a string. Thus, data can be delete for individual controls. The only drawback would be that you have to call it multiple times if you want to delete data for every control on a gui. But since you have to call it the same way for resize, it is just a copy&paste action. Maybe a "deleteAll" for the a string could be used as a shortcut.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2006, 5:11 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
toralf wrote:
The only improvement I could see is to avoid the "i" in the last loop by using "A_index" all the time.
That would take up too much space lol

toralf wrote:
But it doesn't seem to improve speed (It is fast anyway). Have you made measurements?
No I just assumed RegEx would be faster than several string commands. Either way, the speed difference would be insignificant. If you want, you can compare benchmark results with older versions.

toralf wrote:
It might be possible to use RegExMatch for this as well, instead of StringMin and StringSplit.
Thanks, I made this change in version 3.4.1 along with a few other things.

toralf wrote:
Do you see any way to store only the data needed
I prefer to keep it this way as it eliminates bugs with duplicates like Anchor("ctrl", "w") ... Anchor("ctrl", "h.5"). Due to the new RegEx I don't think it's possible anyway.

toralf wrote:
I think the best approach is to specify "delete" for the a string.
That would be a problem if you have a gui control with the variable 'delete'.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2006, 7:18 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Titan wrote:
toralf wrote:
I think the best approach is to specify "delete" for the a string.
That would be a problem if you have a gui control with the variable 'delete'.
I suggested to use the string "delete" for the "a" string (second parameter). Not for the "ctrl" string (first parameter). This way there is no conflict with control names.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 29th, 2006, 6:13 pm 
Offline

Joined: October 10th, 2005, 10:44 am
Posts: 299
Location: Germany
Rajat wrote:
I got late in testing out this nice function... its very well-made and works great.. thanks for posting!
Ditto on all accounts! (Except that I'm even later than Rajat... )
Great job, Titan, as always!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2006, 9:47 pm 
Offline

Joined: May 7th, 2005, 8:24 am
Posts: 26
Location: USA
I'm getting a "Call to nonexistant function" error from line 10. Is it just me? I've got both the Anchor.ahk and the anchor-example.ahk. The error is in the Anchor.ahk.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2006, 9:49 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
You have to use the latest AHK version.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2006, 10:11 pm 
Offline

Joined: May 7th, 2005, 8:24 am
Posts: 26
Location: USA
never mind, the commented version works PERFECTLY! Thank you, this is awsome! (I just wish that it was simpler or built in!)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2006, 10:26 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
MisterGank wrote:
I just wish that it was simpler
Me too, if you have any suggestions I'll be glad to hear them.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2006, 3:26 pm 
Hi Titan, :)

I'm currently trying to adapt your new version of Anchor(). I don't get this thing with the factors e.g. x0.5. What's it good for?

Then I'd like to ask if it would be possible to get a commented version of your new script (just like toralf but for the new version ;))?

You know already that I'm using an older version of your function within my BBCodeWriter script. :mrgeen: The concerning code is:
Code:
      Anchor("EdtComment"   , ""  , ""  , EdtW, EdtH    )
      Anchor("GrpMenuBorder", ""  , ""  , GrpW, ""      )
      Anchor("ChkSig"       , ""  , ChkY, ""  , ""      )
      Anchor("DDLSig"       , ""  , DDLY, ""  , ""      )
      Anchor("BtnEditSig"   , ""  , BSgY, ""  , ""      )
      Anchor("BtnDelSig"    , ""  , BSgY, ""  , ""      )
      Anchor("BtnSend"      , BG1X, BG3Y, ""  , ""  , 1 )
      Anchor("BtnPreview"   , BG2X, BG3Y, ""  , ""  , 1 )
      Anchor("BtnReset"     , BG3X, BG3Y, ""  , ""  , 1 )
      Anchor("BtnPinned"    , BG4X, ""  , ""  , ""      )


Do I have to change s.th here or could I just paste your new version over the old one?
_______________________
Cheers
AGU


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 172 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 12  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher, nomissenrojb, SKAN, Stigg, Yahoo [Bot] and 18 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