 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
haichen
Joined: 05 Feb 2007 Posts: 110 Location: Osnabrück, Germany
|
Posted: Tue Jan 08, 2008 1:42 pm Post subject: |
|
|
Hi majkinetor,
I think I got it work.
Try this:
| Code: | ...
GuiSize:
Anchor("static1", "x")
Anchor("SysTreeView321", "w")
Anchor("AtlAxWin1", "x")
Anchor("ComboBox1", "w")
Anchor("button1", "x")
return
... |
and in Separator_Move(all=false)
| Code: | ...
ControlMove, AtlAxWin1, x+w,,w1+x1-x-w,,A
Anchor("","","",1)
}
GuiClose:
... |
It worked only for your modified Anchor 4.1! I think, i was not able to reset the new Anchor 4.56 properly.
Hopefully this would help.
And thanks for your wonderful coding!
 |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3626 Location: Belgrade
|
Posted: Tue Jan 08, 2008 1:54 pm Post subject: |
|
|
OK. I definitely got closer.
This is what works almost correctly with modified Anchor in RSS case.
First, I had problem with A_GUI so I hardcoded gn := 1.
Then I have this:
Anchor(i="", a = "", r = false)
so that first param is optional
Reset goes like this:
| Code: | If !z or !i
{
VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), z := true, cl=0, gx = 1
return
}
gn := 1
|
And in RSS code, reseting is done like this:
| Code: | Separator_Move() {
.....
Anchor() ;reset
gosub GuiSize ;reinitialise with new setup, (this is the reason for hardcoding gn as A_Gui isn't set here
} |
and GuiSize normaly:
| Code: | GuiSize:
Anchor("SysTreeView321", "h")
Anchor("AtlAxWin1", "wh")
return |
The reason for this is that GuiSize is called on application startup, so I thought, to achieve the same result, I must call it manualy after reseting the Anchor.
This is what I prefer reseting to be. You dont' have to reset each control as you can just call guisize after blank Anchor to reset everything. I don't see a point in reseting control by control.
2 haichen.
Thx m8, but that doesn't work here. It also isn't what I want - I want only those 2 controls anchored, nothing else. Only separator should change widh and x of button and combo, Anchor shouldn't touch it.
EDIT: It still doesn't work correctly as I described here cuz of reference to A_GuiWidth & A_GuiHeight, but this can be easily fixed. _________________

Last edited by majkinetor on Tue Jan 08, 2008 2:17 pm; edited 1 time in total |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Tue Jan 08, 2008 2:14 pm Post subject: |
|
|
| majkinetor wrote: | | I am wondering, is it possible to have single Anchor call without parameters to reset everything ? [...] I tried to do it myself and mod behaves much better. Bug is produced only when window is maximized and restored. | Clearing Anchors data structs is very unreliable as it purges stats across all GUIs and gives the incorrect relative bounds to controls the next time the window is resized. This is especially noticeable if you artificially move, maximize or restore windows, and when your visual theme is not set to "Show window contents while dragging." I think haichens code coupled with the fact that AtlAxWin1 is always sized correctly proves that the error lies in the way your splitter control moves SysTreeView321; have you tried using Anchor to move the attached controls instead of Separator_Move? _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Last edited by Titan on Tue Jan 08, 2008 2:29 pm; edited 1 time in total |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3626 Location: Belgrade
|
Posted: Tue Jan 08, 2008 2:29 pm Post subject: |
|
|
| Quote: | | have you tried using Anchor to move the attached controls instead of Separator_Move? |
I am not sure if that is possible. Anyway, I already told you this is NOT where the bug is. The bug is in the Anchor. I am not here to moke you but try to help you fix this (no matter what kind of history two us have). I already said that its not possible that separator works incorrectly or every control would be at bad location or with bad size cuz of:
| Code: | ControlMove, SysTreeView321, ,, x-5,,A
ControlMove, ComboBox1, ,, x-30,,A
ControlMove, Button1, x-25,,,,A
ControlGetPos, x1,,w1,,AtlAxWin1,A
ControlMove, AtlAxWin1, x+w,,w1+x1-x-w,,A
|
So, if X or anything goes bad here, ControlMove will fail or position control incorrectly relative to the separator and this never happens.
Also, its impossible that this error occurs in all of my scripts that manualy change windows, and with haichen scripts too. I told you that reseting Anchor completely behaves much better in mentioned cases, so you should try to fix it using that approach (you can at least release test version for me/us to try)
| Quote: | | Clearing Anchors data structs is very unreliable as it purges stats across all GUIs and gives the incorrect relative bounds to controls the next time the window is resized. |
That is what the reset is suposed to do. Clear everything
Anyway, if you know the way to reimplement separator using just Anchor, I am willing to switch. Anchor is acctually special case of Separator, as it is more general - you need 2 anchors to simulate 1 horizontal separator. When you move separator, you can anlyze window internals as two separate windows, one to be resized right (with its controls, those right of separator) and other to be resized left, with Anchor X and W rules.
Vertical separator will use 2 Anchors with Y and H rules. _________________

Last edited by majkinetor on Tue Jan 08, 2008 2:34 pm; edited 1 time in total |
|
| Back to top |
|
 |
haichen
Joined: 05 Feb 2007 Posts: 110 Location: Osnabrück, Germany
|
Posted: Tue Jan 08, 2008 2:33 pm Post subject: |
|
|
With your new Reset for Anchor my changing works also well.
I only have to reverse the sequence of SysTreeView and AtlAxWin in guisize. No hardcoding necessary.
If not changing the sequence, the first feed article (only!) isnt changing his width. Curious.
| Code: | GuiSize:
Anchor("static1", "x")
Anchor("AtlAxWin1", "x")
Anchor("SysTreeView321", "w")
Anchor("ComboBox1", "w")
Anchor("button1", "x")
return |
| Code: | ControlMove, AtlAxWin1, x+w,,w1+x1-x-w,,A
; Anchor("","","",1)
Anchor()
}
GuiClose: |
| Code: | Anchor(i = "", a = "", r = false) {
static c, cs = 12, cx = 255, cl = 0, g, gs = 8, z = 0, k = 0xffff, gx = 1
If !z or !i
{
VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), z := true, cl=0, gx = 1
return
} |
This are the changings wich are working with your modified Anchor 4.56.
EDIT:
Oh sorry, you're writing too fast. I see your comment after writing this. |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3626 Location: Belgrade
|
Posted: Tue Jan 08, 2008 3:41 pm Post subject: |
|
|
There is also another way to do it, in order to solve A_Gui, A_GuiWidth and A_GuiHeight problem. Reset is done on first next call:
| Code: | Separator_Move() {
....
reset := true
tooltip reset on next call
}
GuiSize:
if reset
{
reset := Anchor() ; if Anchor returns 0 on reset.
tooltip reset
}
Anchor("SysTreeView321", "h")
Anchor("AtlAxWin1", "wh")
return |
Now, the bug occures ONLY on 1 place: when you move separator and maximize imediately after it. If you resize instead of maximizing as first action after separating, and then maximize, the bug doesn't appear.
So, if we can solve this maximization problem, reseting is complete.
The bottom line is:
- Anchor can use global variable Anchor_reset. When set to true, Anchor will reset itself on next call and continue normaly. That way, to work correctly with anchor in any situation, you just need to set this global whenever you mess with controls. In above example:
| Code: | Separator_Move() {
global Anchor_reset
....
Anchor_reset := true ;reset anchor on next guisize
}
;standard anchor thing
GuiSize:
Anchor("SysTreeView321", "h")
Anchor("AtlAxWin1", "wh")
return |
| Quote: | | If not changing the sequence, the first feed article (only!) isnt changing his width |
This is what I have too. Strange. Only happens first time. Probably some side effect of my messing with Anchor without going to deep into its internals. Titan would know better. _________________
 |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Tue Jan 08, 2008 5:14 pm Post subject: |
|
|
Clearing variables is definitely not an option for the reasons I mentioned earlier. Resetting should assume the current GUI size for the relative bounds of a specified control, allowing your anchors to behave the same as if the new window size were to be the initial one.
I made a few subtle changes to v4.57a which on my system produces flawless resizing on your RSS Reader script. There is the odd side effect when the GUI is resized for the very first time and I will try to resolve this later on. _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3626 Location: Belgrade
|
Posted: Tue Jan 08, 2008 6:12 pm Post subject: |
|
|
The latest version works nice here. I didn't have any problems, even with "very first time" resizing.
I will wait your final code to test troughly with all other scripts I have.
Thx.
Note: There is a little quirk of IE control which sometimes produce the bug here which I tried to solve. It is the fact that IE control doesn't display full range of the vertical scroll bare until it is clicked ?! So I artificialy clicked it in funtction:
| Code: | RSS_ParseFeed(parent=0, icoNum=0){
.....
;click on IE or scroll bar is bugged
sleep, 100
controlclick, Internet Explorer_Server1, ahk_id %hGui%,,,,x-1000 y-1000
} |
Remove those lines when you test, as it somehow makes separator behaves as clicked...
EDIT
Ah, I noticed that bug you mention. It happens here when you move separator left, and then resize window left (but not always, random)
At any case, latest version works sifnificantly better and the main differenc is that error doesn't accumulate but corrects itself after you click separator again. _________________
 |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Tue Jan 08, 2008 6:36 pm Post subject: |
|
|
| majkinetor wrote: | | IE control doesn't display full range of the vertical scroll bare until it is clicked | In the Anchor call for AtlAxWin1 specifying true for the redraw parameter fixes this problem for me. I noticed this causes flickering but I suppose it's unavoidable since clicking internally invokes a repaint of a similar nature, at a lower frequency.
| majkinetor wrote: | | Ah, I noticed that bug you mention. It happens here when you move separator left, and then resize window left (but not always, random) | Ironically I couldn't reproduce this behaviour any more, no matter how I tried. It's frustrating to experience these random quirks especially when you don't know the reason.
| majkinetor wrote: | | ...the main differenc is that error doesn't accumulate but corrects itself after you click separator again. | It's not really an error, all the compounding calculations were correct. The bug was changing width and height values when w nor h were present in the anchor list. _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3626 Location: Belgrade
|
Posted: Tue Jan 08, 2008 7:01 pm Post subject: |
|
|
| Quote: | | In the Anchor call for AtlAxWin1 specifying true for the redraw parameter fixes this problem for me |
This isn't related to Anchor. This happens with no Anchor present. _________________
 |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Tue Jan 08, 2008 9:33 pm Post subject: |
|
|
Then I don't understand why you mentioned it.
Anyway are there any outstanding issues with v4.57a, does it work with your other scripts too? _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3626 Location: Belgrade
|
Posted: Wed Jan 09, 2008 9:48 am Post subject: |
|
|
| Quote: | | Then I don't understand why you mentioned it. |
Because you should remove this line, as i noticed that this click can sometimes scramble controls?! It looks like its interpreted as click on separator in some weird situations.
Except that random bug, nothing else. _________________
 |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Wed Jan 09, 2008 9:19 pm Post subject: |
|
|
Anchor v4.06a eliminates the dependency on A_Gui, A_GuiWidth and A_GuiHeight by using WinAPI methods to enumerate window properties. As a result the n: prefix must not be used. Custom controls or ones with their own parent window (such as splitters) require that the container GUI be made default with Gui, +LastFound prior to resetting. These details and more have been covered in the documentation. _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
ewerybody
Joined: 18 Sep 2006 Posts: 14
|
Posted: Thu Jul 10, 2008 5:45 pm Post subject: |
|
|
Hey I just wanted to show my appreciation
Very very cool script! I think that was on of the last things that kept me from saying Autohotkey has a cool UI-system! Now THATs definitely cool! |
|
| 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
|