Jump to content
Sign in to follow this  
komalo

picture position returns

Recommended Posts

komalo

hi

i am facing a new problem

when i move the image with control move in negative

position it returns to its previously position , the example explains what i am facing

try to move the pic by draging it and then resize the window using the border

as you see i tried also GUICtrlSetResizing with no success

#include <misc.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>

$gui = GUICreate("aaaa",500,400,100,100,$WS_CLIPCHILDREN + $WS_SIZEBOX)
$ip = GUICtrlCreatePic(@WindowsDir & "\Web\Wallpaper\Bliss.bmp", 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetResizing($ip,$GUI_DOCKALL+ $GUI_DOCKSIZE)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYDOWN
            $nc = GUIGetCursorInfo()
            If $nc[4] = $ip Then
                $mp = MouseGetPos()
                $cp = ControlGetPos($gui, "", $ip)
                While _IsPressed(1)
                    $nm = MouseGetPos()
                    ControlMove($gui, "", $ip, $cp[0] - $mp[0] + $nm[0], $cp[1] - $mp[1] + $nm[1])
                WEnd
            EndIf
    EndSwitch
WEnd
Edited by komalo

[font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]

Share this post


Link to post
Share on other sites
martin

hi

i am facing a new problem

when i move the image with control move in negative

position it returns to its previously position , the example explains what i am facing

try to move the pic by draging it and then resize the window using the border

as you see i tried also GUICtrlSetResizing with no success

#include <misc.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>

$gui = GUICreate("aaaa",500,400,100,100,$WS_CLIPCHILDREN + $WS_SIZEBOX)
$ip = GUICtrlCreatePic(@WindowsDir & "\Web\Wallpaper\Bliss.bmp", 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetResizing($ip,$GUI_DOCKALL+ $GUI_DOCKSIZE)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYDOWN
            $nc = GUIGetCursorInfo()
            If $nc[4] = $ip Then
                $mp = MouseGetPos()
                $cp = ControlGetPos($gui, "", $ip)
                While _IsPressed(1)
                    $nm = MouseGetPos()
                    ControlMove($gui, "", $ip, $cp[0] - $mp[0] + $nm[0], $cp[1] - $mp[1] + $nm[1])
                WEnd
            EndIf
    EndSwitch
WEnd
Yes, instead of ControlMove use

GUICtrlSetPos($ip, $cp[0] - $mp[0] + $nm[0], $cp[1] - $mp[1] + $nm[1])

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
komalo

well i need to move the control on several guis and guisetpos applies on one gui

also , it will still move on resizing the window , all what i am trying to do is to

make it in it current position on resizing .

Edited by komalo

[font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]

Share this post


Link to post
Share on other sites
martin

well i need to move the control on several guis and guisetpos applies on one gui

also , it will still move on resizing the window , all what i am trying to do is to

make it in it current position on resizing .

I don't understand that. You mention guisetpos but I assume you mean guictrlsetpos?

What does it mean "to move the control on several guis"?

Do you mean "move different controls on different guis"?

Are the guis all created with your script?

When you say "make it in its current position on resizing" then that is what I think happens if you move the control with GuiCtrlSetPos. But maybe I just don't understand.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
komalo

guisetpos was a mistake i meant guictrlsetpos

to move the control on several guis = move different controls on different guis

Are the guis all created with your script? No

"make it in its current position on resizing" = when resizing the window using the border , keep the pic position

Edited by komalo

[font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]

Share this post


Link to post
Share on other sites
PsaltyDS

well i need to move the control on several guis and guisetpos applies on one gui

also , it will still move on resizing the window , all what i am trying to do is to

make it in it current position on resizing .

Martin is right. You need two changes:

GUICtrlSetResizing($ip,$GUI_DOCKALL); Don't add $GUI_DOCKSIZE
Either just don't add it, or BitOr() it together, because $GUI_DOCKSIZE bits are already set in $GUI_DOCKALL.

...and what Martin said:

While _IsPressed(1)
                    $nm = MouseGetPos()
                    GUICtrlSetPos($ip, $cp[0] - $mp[0] + $nm[0], $cp[1] - $mp[1] + $nm[1])
                WEnd

:P


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
komalo

OKAY THAT WORKS GREAT

i got confused by something else :P

thank you martin your script works 100% :(

thank you PsaltyDS for clearing the $GUI_DOCKSIZE that was the thing confusing me


[font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]

Share this post


Link to post
Share on other sites
martin

OKAY THAT WORKS GREAT

i got confused by something else :P

thank you martin your script works 100% :(

thank you PsaltyDS for clearing the $GUI_DOCKSIZE that was the thing confusing me

Oh good.

And thanks PsaltyDS for deconfusing the confusion that confused me.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
PsaltyDS

And thanks PsaltyDS for deconfusing the confusion that confused me.

No worries. It's just all in ways dork...

:P


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

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  

×