Jump to content
Sign in to follow this  
layer

Pictures being repainted problem

Recommended Posts

layer

Hey guys,

I've been at this for a few hours now :dance: Took my whole day away... And heres the problem. I download 2 pictures from the internet. In the beginning of the script I do a GUICtrlCreatePic for one of them. Then, later on in the script, the user could decide to switch pictures, so they hit a button, and the picture shows up, but in the bottom right hand corner it's all screwy. Now if you move the window around, with a quick swift motion off of the screen, it goes away, but thats a silly hack to use. Here is the code. With the code, do this:

Run it

Hit the "Trops" button

Look in the right bottom corner

Dim $p_win1, $p_win2, $x1 = 10, $x2 = 315, $y1 = 10, $y2 = 10, $Dock = 1, $Dock_Location = 2
$gui1 = GUICreate("Dopplar Radar", 700, 485, (@DesktopWidth - 750) / 2, 50)
InetGet("http://image.weather.com/web/radar/us_nyc_closeradar_large_usen.jpg", @TempDir & "\dopplar.jpg", 1, 0)
InetGet("http://image.weather.com/images/sat/tropsat_600x405.jpg", @TempDir & "\trops.jpg", 1, 0)
$echo = GUICtrlCreatePic(@TempDir & "\dopplar.jpg", 0, 0, 700, 485)
$gui2 = GUICreate("Rad/Sat", 700, 100, -1, -1, -1, -1, $gui1)
$dopplar = GUICtrlCreateButton("Dopplar", 0, 0, 350, 100, 0x8000);0x8000 = $BS_FLAT
$trops = GUICtrlCreateButton("Trops", 350, 0, 350, 100, 0x8000);0x8000 = $BS_FLAT
GUISetState(@SW_SHOW, $gui2)
GUISetState(@SW_SHOW, $gui1)
AdlibEnable("_GetEcho", 30000)

While 1
   $get = GUIGetMsg()
   Select
      Case $get = -3
         Exit
      Case $get = $dopplar
         $pic = 1
         _GetEcho()
      Case $get = $trops
         $pic = 2
         _GetEcho()
      Case Else
         _KeepWindowsDocked()
   EndSelect
WEnd

Func _GetEcho()
   InetGet("http://image.weather.com/web/radar/us_nyc_closeradar_large_usen.jpg", @TempDir & "\dopplar.jpg", 1, 0)
   InetGet("http://image.weather.com/images/sat/tropsat_600x405.jpg", @TempDir & "\trops.jpg", 1, 0)
   If $pic = 1 Then
      $name = "\dopplar.jpg"
   Else
      $name = "\trops.jpg"
   EndIf
   GUICtrlSetImage($echo, @TempDir & $name)
EndFunc  ;==>_GetEcho

Func OnAutoItExit()
   AdlibDisable()
   GUIDelete($gui1)
   GUIDelete($gui2)
   FileDelete(@TempDir & "\dopplar.jpg")
   FileDelete(@TempDir & "\trops.jpg")
EndFunc  ;==>OnAutoItExit

Func _KeepWindowsDocked(); Cheers gafrost
   $p_win1 = WinGetPos($gui1)
   $p_win2 = WinGetPos($gui2)
   If $Dock_Location == 1 Then
      If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($gui1), 8) Or $Dock = 2) Then
         $x1 = $p_win1[0]
         $y1 = $p_win1[1]
         $x2 = $p_win1[2] + $x1
         $y2 = $y1
         WinMove($gui2, "", $x2, $y2)
         $Dock = 1
         Sleep(10)
      ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($gui2), 8)) Then
         Sleep(10)
         $x2 = $p_win2[0]
         $y2 = $p_win2[1]
         $x1 = $p_win2[0] - $p_win1[2]
         $y1 = $y2
         WinMove($gui1, "", $x1, $y1)
      EndIf
      Sleep(10)
   Else
      Sleep(10)
      If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($gui1), 8) Or $Dock = 2) Then
         $x1 = $p_win1[0]
         $y1 = $p_win1[1]
         $x2 = $x1
         $y2 = $p_win1[3] + $y1
         WinMove($gui2, "", $x2, $y2)
         $Dock = 1
      ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($gui2), 8)) Then
         Sleep(10)
         $x2 = $p_win2[0]
         $y2 = $p_win2[1]
         $x1 = $x2
         $y1 = $p_win2[1] - $p_win1[3]
         WinMove($gui1, "", $x1, $y1)
      EndIf
   EndIf
   Sleep(10)
EndFunc  ;==>_KeepWindowsDocked

Suggestions ?

Thanks :dance:

It's probably something easy/silly... :whistle:

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites
layer

Wow, I'm retarted, I gave you a script that doesn't show the problem, just has to remove a line... See post above, it's updated with the right code.


FootbaG

Share this post


Link to post
Share on other sites
jpm

I don't see any problem with .72.

can you post a picture of the wrong part of the update unless you agree the pb is gone

Share this post


Link to post
Share on other sites
layer

Ohhh... I wasn't using the BETA to run it, I was using 3.1.1 ... I tested with .72 and it worked fine, I guess it was a bug that has already been fixed.

Thanks jpm :whistle:


FootbaG

Share this post


Link to post
Share on other sites
jpm

Ohhh... I wasn't using the BETA to run it, I was using 3.1.1 ... I tested with .72 and it worked fine, I guess it was a bug that has already been fixed.

Thanks jpm :whistle:

<{POST_SNAPBACK}>

you welcome :dance:

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.