 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
toralf
Joined: 31 Jan 2005 Posts: 3910 Location: Bremen, Germany
|
Posted: Mon Aug 28, 2006 9:41 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
polyethene
Joined: 11 Aug 2004 Posts: 5248 Location: UK
|
Posted: Mon Aug 28, 2006 10:36 pm Post subject: |
|
|
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  _________________ GitHub Scripts IronAHK Contact by email not private message. |
|
| Back to top |
|
 |
jballi
Joined: 01 Oct 2005 Posts: 748 Location: Texas, USA
|
Posted: Sat Sep 09, 2006 11:54 pm Post subject: |
|
|
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!!
Thanks for sharing!  |
|
| Back to top |
|
 |
jballi
Joined: 01 Oct 2005 Posts: 748 Location: Texas, USA
|
Posted: Wed Oct 18, 2006 8:10 am Post subject: Problems with dynamic GUI |
|
|
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... |
|
| Back to top |
|
 |
polyethene
Joined: 11 Aug 2004 Posts: 5248 Location: UK
|
Posted: Sun Nov 26, 2006 6:03 pm Post subject: Re: Problems with dynamic GUI |
|
|
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. _________________ GitHub Scripts IronAHK Contact by email not private message. |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3910 Location: Bremen, Germany
|
Posted: Mon Nov 27, 2006 3:06 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3910 Location: Bremen, Germany
|
Posted: Mon Nov 27, 2006 3:15 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
polyethene
Joined: 11 Aug 2004 Posts: 5248 Location: UK
|
Posted: Mon Nov 27, 2006 4:11 pm Post subject: |
|
|
| 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'. _________________ GitHub Scripts IronAHK Contact by email not private message. |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3910 Location: Bremen, Germany
|
Posted: Mon Nov 27, 2006 6:18 pm Post subject: |
|
|
| 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  |
|
| Back to top |
|
 |
Ace_NoOne
Joined: 10 Oct 2005 Posts: 299 Location: Germany
|
Posted: Wed Nov 29, 2006 5:13 pm Post subject: |
|
|
| 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! |
|
| Back to top |
|
 |
MisterGank
Joined: 07 May 2005 Posts: 26 Location: USA
|
Posted: Thu Nov 30, 2006 8:47 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3910 Location: Bremen, Germany
|
Posted: Thu Nov 30, 2006 8:49 pm Post subject: |
|
|
You have to use the latest AHK version. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
MisterGank
Joined: 07 May 2005 Posts: 26 Location: USA
|
Posted: Thu Nov 30, 2006 9:11 pm Post subject: |
|
|
| never mind, the commented version works PERFECTLY! Thank you, this is awsome! (I just wish that it was simpler or built in!) |
|
| Back to top |
|
 |
polyethene
Joined: 11 Aug 2004 Posts: 5248 Location: UK
|
Posted: Thu Nov 30, 2006 9:26 pm Post subject: |
|
|
| MisterGank wrote: | | I just wish that it was simpler | Me too, if you have any suggestions I'll be glad to hear them. _________________ GitHub Scripts IronAHK Contact by email not private message. |
|
| Back to top |
|
 |
AGU Guest
|
Posted: Sun Dec 03, 2006 2:26 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|