Sign in to follow this  
Followers 0
tomashen

image in gui in a square

11 posts in this topic

is it posible to make a square in gui

and in that square u put image which u can move around with keyboard buttons...

but when u move the image it will only move around that certain square.

not like all over the gui


Proud of AutoIt Proud of MySelf :)

Share this post


Link to post
Share on other sites



Check the help file for GUICtrlCreatePic and try example 2.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

from wat i understand on it is... u basicaly create 2 guis? the gui on top is dragable by gui#1 ?

and gui#2 is the movable image?


Proud of AutoIt Proud of MySelf :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Right. The picture GUI (gui#2) is a child of the main GUI (gui#1)

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

umm for some reason my picture on gui#2 wont show lmao... o.O


Proud of AutoIt Proud of MySelf :)

Share this post


Link to post
Share on other sites

Did you move the example script to another directory? The image has a relative path so you either have to change the path or copy the image as well.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

no path was changed ... but um never mind i fixed it.. my mistake was.. taht i mistakenly did

GUICreate("", 0,1,2,3)  ;i put 0 as 0 ;1 as 0; and 2/3 i put as the size

i did the coords of GUICreate as for GUICtrlCreate... :D btu no w i fixed it..

EDIT:

um also is there a way to get rid of flashing?

Edited by tomashen

Proud of AutoIt Proud of MySelf :)

Share this post


Link to post
Share on other sites

When I run the example script I get no flashing on Windows 7 64bit.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

no no no i mean ..

umm here

$GUI=GUICreate("TEST...", 800, 600)

$pic = GUICreate("", 400, 300, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $gui)
$img = GUICtrlCreatePic("Dataimg.JPG", -1, -1, 800, 600)


;===================================================================


guisetstate(@SW_SHOW, $GUI)
GUISetState(@SW_SHOW, $pic)
while 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSe
        Exit 1
    EndSwitch
controls()
WEnd

Func controls()

    If _IsPressed("25") then
        If _IsPressed($SPEED_WALK_PRESS) Then
            move($NRML_MOVE)
            GUICtrlSetPos($img, $CHAR2[0]-1, $CHAR2[1])
        Else
            move($FLY_MOVE)
            GUICtrlSetPos($img, $CHAR2[0]-1, $CHAR2[1])
        EndIf
        map(1,1)
    EndIf
    If _IsPressed("26") Then
        If _IsPressed($SPEED_WALK_PRESS) Then
            move(10)
            GUICtrlSetPos($img, $CHAR2[0], $CHAR2[1]-1)
        Else
            move(50)
            GUICtrlSetPos($img, $CHAR2[0], $CHAR2[1]-1)
        EndIf
        map(1,1)
    EndIf
    If _IsPressed("27") Then
        if _IsPressed($SPEED_WALK_PRESS) Then
            move(10)
            GUICtrlSetPos($img, $CHAR2[0]+1, $CHAR2[1])
        Else
            move(50)
            GUICtrlSetPos($img, $CHAR2[0]+1, $CHAR2[1])
        EndIf
        map(1,1)
    EndIf
    If _IsPressed("28") Then
        If _IsPressed($SPEED_WALK_PRESS) Then
            move(10)
            GUICtrlSetPos($img, $CHAR2[0], $CHAR2[1]+1)
        Else
            move(50)
            GUICtrlSetPos($img, $CHAR2[0], $CHAR2[1]+1)
        EndIf
        map(1,1)
    EndIf
    Return
EndFunc

when im moving the image it flashes when being moved :/


Proud of AutoIt Proud of MySelf :)

Share this post


Link to post
Share on other sites

I can't test your script because a lot of stuff is missing.

But I think you get the flashing because of _IsPressed. This function returns true for quite some time. I tested with the following script and got about 64 milliseconds (press Tab to start the measurement and ESC to exit the script).

So if your loop needs less time to process you will run the code for a key press multiple times.

#include <Misc.au3>
$hTime = TimerInit()
While 1
    If _IsPressed("09") Then ConsoleWrite(TimerDiff($hTime) & @CRLF)  ; Tab
    If _IsPressed("1B") Then Exit         ; ESC to exit the script
WEnd

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Here?:

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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