Jump to content

Recommended Posts

Posted

I'm attempting to simulate a selection rectangle..... but the GUI does not appear to refresh correctly, and I get a lot of "ghost" lines as I resize the rectangle....

Suggestions?

GuiCreate("Mouse down ... drag southeast ... mouse up")

Dim $p[2];used to backup previous mouse position
$rect = GuiCtrlCreateLabel("foo", -99, -99, 1, 1, 0x107) ;transparent label with black border

GuiSetState()
Do
   $i = GUIGetCursorInfo()
   If $i[2] == 1 Then;primary mouse is down
      If $p[0] = -99 Then $p[0] = $i[0];x-coord
      If $p[1] = -99 Then $p[1] = $i[1];y-coord
      GUICtrlSetPos($rect, $p[0], $p[1], $i[0]-$p[0], $i[1]-$p[1])
   Else
      GUICtrlSetPos($rect, -99, -99, 1, 1)
      $p[0] = -99
      $p[1] = -99
   EndIf
Until GuiGetMsg() = -3
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

:)

I'm attempting to simulate a selection rectangle..... but the GUI does not appear to refresh correctly, and I get a lot of "ghost" lines as I resize the rectangle....

Suggestions?

GuiCreate("Mouse down ... drag southeast ... mouse up")

Dim $p[2];used to backup previous mouse position
$rect = GuiCtrlCreateLabel("foo", -99, -99, 1, 1, 0x107);transparent label with black border

GuiSetState()
Do
   $i = GUIGetCursorInfo()
   If $i[2] == 1 Then;primary mouse is down
      If $p[0] = -99 Then $p[0] = $i[0];x-coord
      If $p[1] = -99 Then $p[1] = $i[1];y-coord
      GUICtrlSetPos($rect, $p[0], $p[1], $i[0]-$p[0], $i[1]-$p[1])
   Else
      GUICtrlSetPos($rect, -99, -99, 1, 1)
      $p[0] = -99
      $p[1] = -99
   EndIf
Until GuiGetMsg() = -3

<{POST_SNAPBACK}>

I just upload a new AutoIt3-gui tha's solved the problem for you I hope I din't create more filckering problem for others :)
Posted

:)

I just upload a new AutoIt3-gui tha's solved the problem for you I hope I din't create more filckering problem for others :)

<{POST_SNAPBACK}>

Yikes, my AutoBuilder Prototype has major flickering problems with that AutoIt3-gui ;)

Try the following (use the background.bmp file from AutoBuilder):

GuiCreate("Mouse down ... drag southeast ... mouse up")

Dim $p[2];used to backup previous mouse position
$rect = GuiCtrlCreateLabel("foo", -99, -99, 1, 1, 0x107) ;transparent label with black border

$background = GuiCtrlCreatePic(@ScriptDir & "\background.bmp", 100, 100, 1024, 768)
$button = GuiCtrlCreateButton("Button", 200, 200, 100, 40)

GuiSetState()
Do
   $i = GUIGetCursorInfo()
   If $i[2] == 1 Then;primary mouse is down
      If $p[0] = -99 Then $p[0] = $i[0];x-coord
      If $p[1] = -99 Then $p[1] = $i[1];y-coord
      GUICtrlSetPos($rect, $p[0], $p[1], $i[0]-$p[0], $i[1]-$p[1])
   Else
      GUICtrlSetPos($rect, -99, -99, 1, 1)
      $p[0] = -99
      $p[1] = -99
   EndIf
Until GuiGetMsg() = -3
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted (edited)

Yikes, my AutoBuilder Prototype has major flickering problems with that AutoIt3-gui :)

I found a solution for not flickering but the bad news is that on the .bmp is not painting. see AutoitGui.6

I think that is due to overlap control. I don't if i will ever find a solution on this overlap problem. :)

EDIT: I got a solution create the .bmp before the label

Edited by jpm
Posted

I've tried creating the .bmp before the label .... it works okay, but there is still a bit of flicker with AutoBuilder when I move the mouse over a control (due to overlay label) :)

<{POST_SNAPBACK}>

I see the flickering no idea what the relation with the modification I did for CtrlSetPos I have a look if I can avoid it :)
Posted

I am not sure to understand the prototype but It looks like you need to us GuiCtrlSetPos during the move of the mouse.

If yes what is the exact line(s) in the 16 oct version so I can find a go around

Posted

jpm, please try this simplified AutoBuilder-like code..... (You need the background.bmp file from AutoBuilder)

GuiCreate("Refresh Example...")

$overlay = GuiCtrlCreateLabel("", -99, -99, 1, 1, 0x107);transparent label with black border
$background = GUICtrlCreatePic(@ScriptDir & "\background.bmp", 0, 0, 1024,768);used to show a grid
GUICtrlSetState($background, 128);disable background so $i[4] below contains a useful value...

$button1 = GuiCtrlCreateButton("Button1", 130, 130, 100, 30)
$button2 = GuiCtrlCreateButton("Button2", 130, 180, 100, 30)
$button2 = GuiCtrlCreateCheckbox("Button3", 130, 230, 100, 30)
$button2 = GuiCtrlCreateCheckbox("Button4", 130, 270, 100, 30)

GuiSetState()
Do
   $i = GuiGetCursorInfo();we are interested in array element 4
  ; When mouse hovers over a control, display an overlay on top of it
   If $i[4] <> 0 And $i[4] <> $background Then
      $p = ControlGetPos("","",$i[4])
      GuiCtrlSetPos($overlay, $p[0], $p[1], $p[2], $p[3])
   Else   
      GuiCtrlSetPos($overlay, -99, -99, 1, 1);"hide" the overlay off screen
   EndIf
Until GuiGetMsg() = -3;I should use $GUI_EVENT_CLOSE
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted (edited)

@CyberSlug:

what do you think about this?:

$WS_CLIPSIBLINGS = 0x04000000
$width = 400
$height = 400
GUICreate("Mouse down ... drag southeast ... mouse up", $width, $height)

$background = GUICtrlCreatePic(@ScriptDir & "\background.bmp", 0, 0, 1024, 768,$WS_CLIPSIBLINGS)

$button = GUICtrlCreateButton("Button", 200, 200, 100, 40)

$rect = GUICtrlCreateLabel("foo", -1, -1, 1, 1,0x107);transparent label with black border

$clicked = 0
$px = -1
$py = -1
$pxn = -1
$pyn = -1

GUICtrlSetPos($rect, 0, 0, 1, 1)
GuiSetState()

Do
    $i = GUIGetCursorInfo()
    $x = $i[0]
    $y = $i[1]
    If $i[2] == 1 Then
        If $clicked = 0 Then
            $px = $i[0]
            $py = $i[1]
            $clicked = 1
        ElseIf $clicked = 1 And ($pxn <> $i[0] Or $pyn <> $i[1]) Then
            $pxn = $i[0]
            $pyn = $i[1]

            $x = $px
            $y = $py
            $w = Abs($px - $i[0])
            $h = Abs($py - $i[1])

            If $i[0] < $px Then $x = $i[0]
            If $i[1] < $py Then $y = $i[1]
            
            If $x >= 0 And $y >= 0 And ($x + $w) <= $width And ($y + $h) <= $height Then
            ;GUICtrlSetPos($rect, 0, 0, 1, 1); only needed for older gui-beta-version
                GUICtrlSetPos($rect, $x, $y, $w, $h)
            EndIf
        EndIf
    EndIf
    If $i[2] == 0 Then
        If $clicked = 1 Then
            $px = -1
            $py = -1
            $pxn = -1
            $pyn = -1
            $clicked = 0
            GUICtrlSetPos($rect, 0, 0, 1, 1)
        EndIf
    EndIf
Until GUIGetMsg() = -3

Regards :)

Holger

Upd: maybe WS_CLIPSIBLINGS is the answer...

Edited by Holger
Posted

@CyberSlug: do you know what? with the official unstable version and WS_CLIPSIBLINGS it works, but with JPM's newest version it doesn't -> so I think there is now a problem in the JPM-version.

But I don't know what he did to get away the flickering thing....

Posted

@CyberSlug: do you know what? with the official unstable version and WS_CLIPSIBLINGS it works, but with JPM's newest version it doesn't -> so I think there is now a problem in the JPM-version.

But I don't know what he did to get away the flickering thing....

<{POST_SNAPBACK}>

I did the same as jon for the refresh of the resizing of the label which is ok for the border around the label but bad for the the mouse movement.
Posted

jpm, please try this simplified AutoBuilder-like code.....  (You need the background.bmp file from AutoBuilder)

GuiCreate("Refresh Example...")

$overlay = GuiCtrlCreateLabel("", -99, -99, 1, 1, 0x107);transparent label with black border
$background = GUICtrlCreatePic(@ScriptDir & "\background.bmp", 0, 0, 1024,768);used to show a grid
GUICtrlSetState($background, 128);disable background so $i[4] below contains a useful value...

$button1 = GuiCtrlCreateButton("Button1", 130, 130, 100, 30)
$button2 = GuiCtrlCreateButton("Button2", 130, 180, 100, 30)
$button2 = GuiCtrlCreateCheckbox("Button3", 130, 230, 100, 30)
$button2 = GuiCtrlCreateCheckbox("Button4", 130, 270, 100, 30)

GuiSetState()
Do
   $i = GuiGetCursorInfo();we are interested in array element 4
  ; When mouse hovers over a control, display an overlay on top of it
   If $i[4] <> 0 And $i[4] <> $background Then
      $p = ControlGetPos("","",$i[4])
      GuiCtrlSetPos($overlay, $p[0], $p[1], $p[2], $p[3])
   Else   
      GuiCtrlSetPos($overlay, -99, -99, 1, 1);"hide" the overlay off screen
   EndIf
Until GuiGetMsg() = -3;I should use $GUI_EVENT_CLOSE

<{POST_SNAPBACK}>

At least the modification I did will solve your case see AUTOIT-GUI.7 I am on the way to update it :):)
  • Administrators
Posted

At least the modification I did will solve your case see AUTOIT-GUI.7 I am on the way to update it :)  ;)

Can you just send me the bits you change rather than the whole diff again (I just added most of the .6 version and don't want to look through a big diff file again). :)
Posted

Can you just send me the bits you change rather than the whole diff again (I just added most of the .6 version and don't want to look through a big diff file again). :)

<{POST_SNAPBACK}>

no problem I was thinking you were just slipping ... I mean working for money ...
Posted

:) :)

There is a *little bit* of flicker in this code when resizing the selection rectangle around the button...... but I will gladly live with this because everything else is improved!!!

:D

<{POST_SNAPBACK}>

I think we cannot avoid this can of flickering when control overlay ;)
Posted

@JPM: that is normally cause the transparent label is like a complete rect that has to be repainted I think!?

And in CyberSlugs script there is a bug too, so the function GUICtrlSetPos will ever be called if the mouse button is hold.

So I changed it a little bit that the function is only called when there is a change of the mouse position :)

So long

Holger

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...