Sign in to follow this  
Followers 0
Armand

GUICtrlSetPos() with OBJs -> please help :(

6 posts in this topic

#1 ·  Posted (edited)

helo.

as i've been trying all last night to realize what should i move, the OBJ, or the OBJ control.

my code:

$DescriptionOBJ = ObjCreate("Shell.Explorer.2") ; Create Internet Explorer application
$DescriptionOBJ_ctrl = GUICtrlCreateObj($DescriptionOBJ, 212, $DescriptionMinMax[0] + 22, 772, 261)

and with the above code i'm trying to change the position of the control, however it seems like i am moving the wrong part of the control which always takes an off-set and pops up at a different location.

Should i move the '$DescriptionOBJ' Or the '$DescriptionOBJ_ctrl' ?!?!?!

- any help will be appreciated - THANKS !

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites



By far I've also tried to use the following code instead of the 'GUICtrlSetPos' mathode!

guictrlmoveOBJ($DescriptionOBJ,$desedtpos[0], $desedtpos[1], ($Left - $desgrppos[0]) - 8, $desedtpos[3])

Func guictrlmoveOBJ($OBJect,$left,$top,$width,$height)
$OBJect.PutProperty('Left',$left)
$OBJect.PutProperty('Top',$top)
$OBJect.PutProperty('Width',$width)
$OBJect.PutProperty('Height',$height)
EndFunc

Still nothing works !


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites

You need to move the ControlID, not the object reference. Try this demo:

#include <guiconstants.au3>
#include <IE.au3>

Global $PosFlag = 0

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test", 600, 400)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")

$oIE_Embed = _IECreateEmbedded()
$IE_Embed_Ctrl = GUICtrlCreateObj($oIE_Embed, 10, 10, 580, 340)
_IENavigate($oIE_Embed, "http://www.google.com")

GUICtrlCreateButton("Click Me", 250, 360, 100, 30)
GUICtrlSetOnEvent(-1, "_ClickMe")

GUISetState()

While 1
    Sleep(20)
WEnd

Func _ClickMe()
    If $PosFlag Then
        $PosFlag = 0
    Else
        $PosFlag = 1
    EndIf
    GUICtrlSetPos($IE_Embed_Ctrl, 10, 10 + (40 * $PosFlag))
    GUICtrlSetPos(@GUI_CtrlId, 250, 360 - (350 * $PosFlag))
    _IEAction($oIE_Embed, "refresh")
EndFunc   ;==>_ClickMe

Func _Quit()
    Exit
EndFunc   ;==>_Quit

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

dude your script works great however it's not helping me.

- when i am using the same positions of the 'GuiCtrlSetPos()' function with my previously used EditBox control it seems to move the control alright ! but when i am using the same EXACT functions and pixel locations (SAME DETAILS !!!) in the 'guictrlsetpos()' with my new Explorer OBJ it seems to move the control differently - WHY ?!

- my best guess is that it's got to do with the following:

$desedtpos = ControlGetPos($ULEMainGui, "", $DescriptionOBJ)

Please Help!


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites

dude your script works great however it's not helping me.

- when i am using the same positions of the 'GuiCtrlSetPos()' function with my previously used EditBox control it seems to move the control alright ! but when i am using the same EXACT functions and pixel locations (SAME DETAILS !!!) in the 'guictrlsetpos()' with my new Explorer OBJ it seems to move the control differently - WHY ?!

- my best guess is that it's got to do with the following:

$desedtpos = ControlGetPos($ULEMainGui, "", $DescriptionOBJ)

Please Help!

You keep posting incomplete code fragments. Post a complete demo script that can be run and demonstrates your issue...

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

well, i would if i could! as of what i've noticed the control is SOMEHOW - CHANGING IT"S size on it's OWN !!!

- right after it's being created it works fine and it shows the correct details using the 'controlgetpos()'.

- but after a couple of functions the OBJ seems to get a new location - left=8 ?!?!?! WHY ?!!?

Again - thanks in advance !


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0