New topic: 

Weird Issue with Drawpicture

<http://forums.realsoftware.com/viewtopic.php?t=47589>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        mikecotrone          Post subject: Weird Issue with 
DrawpicturePosted: Sat Apr 13, 2013 9:03 pm                         
Joined: Tue Mar 05, 2013 2:33 pm
Posts: 37
Location: North Carolina                Anytime my 
"TopRightAnchorDestinationWidth" is a negative number it doesn't draw when I am 
resizing it. The Y (height) can be positive or negative just fine and it draws 
fine. Has anyone seen this before or perhaps my calculation for the W/H aren't 
making the grade? This is working fine for me for the TopLeft and Bottom Left 
instances of this.

This is my Redraw Method:
g.DrawPicture(po.image, TopRightResizeAnchorX, TopRightResizeAnchorY, 
po.TopRightAnchorDestinationWidth,po.TopRightAnchorDestinationHeight, 0, 0, 
po.Width, po.Height)

This is my calculation for the newWidth:
Round( (Window1.CampusMapCanvas.qLastX - 
Window1.CampusMapCanvas.TopRightResizeAnchorX  ) )

This is my calc for the new Height:
Round( (Window1.CampusMapCanvas.qLastY - 
Window1.CampusMapCanvas.TopRightResizeAnchorY) )

TopRightResizeAnchorX = q.TopRightX // This is the current X position of the 
image for the anchor
TopRightResizeAnchorY = q.TopRightY


Thank you in advance everyone.

Mike      
_________________
Mike Cotrone - CCIE #8411 R&S, CCIE #8411 Voice
Chief Technology Officer 
Onepath Systems, LLC

Real Studio 2012 R2.1 Enterprise, Mac OS, Windows, Ubuntu Linux  
                             Top                timhare          Post subject: 
Re: Weird Issue with DrawpicturePosted: Sat Apr 13, 2013 10:26 pm               
          
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12234
Location: Portland, OR  USA                If your mouse values are integers, 
you don't need to Round() them.  If either width or height goes negative, I 
would adjust the top/left and make it positive.  I don't think DrawPicture 
handles negative width/height very well, although in your experience it would 
seem to handle negative height better than negative width.
dim X, Y, W, H as integer
if po.TopRightAnchorDestinationWidth >= 0 then
  X = TopRightResizeAnchorX
else
  X = TopRightResizeAnchorX + po.TopRightAnchorDestinationWidth
end
if po.TopRightAnchorDestinationHeight >= 0 then
  Y = TopRightResizeAnchorY
else
  Y = TopRightResizeAnchorY + po.TopRightAnchorDestinationHeight
end
W = abs(po.TopRightAnchorDestinationWidth)
H = abs(po.TopRightAnchorDestinationHeight)
g.DrawPicture(po.image, X, Y, W, H, 0, 0, po.width, po.height)
   
                             Top                mikecotrone          Post 
subject: Re: Weird Issue with DrawpicturePosted: Sun Apr 14, 2013 8:42 am       
                  
Joined: Tue Mar 05, 2013 2:33 pm
Posts: 37
Location: North Carolina                timhare wrote:If your mouse values are 
integers, you don't need to Round() them.  If either width or height goes 
negative, I would adjust the top/left and make it positive.  I don't think 
DrawPicture handles negative width/height very well, although in your 
experience it would seem to handle negative height better than negative width.
dim X, Y, W, H as integer
if po.TopRightAnchorDestinationWidth >= 0 then
  X = TopRightResizeAnchorX
else
  X = TopRightResizeAnchorX + po.TopRightAnchorDestinationWidth
end
if po.TopRightAnchorDestinationHeight >= 0 then
  Y = TopRightResizeAnchorY
else
  Y = TopRightResizeAnchorY + po.TopRightAnchorDestinationHeight
end
W = abs(po.TopRightAnchorDestinationWidth)
H = abs(po.TopRightAnchorDestinationHeight)
g.DrawPicture(po.image, X, Y, W, H, 0, 0, po.width, po.height)


I wasn't sure about the X/Y without Rounding thanks for that tip! I will work 
on making the Width positive and see if the image will show on the "left" side 
of the anchor (reversed).

Also so I am clear as describing pictures can be hard When I drag the 
bottom/top right I can have my height pos or negative as long as it is to the 
right/up/down from the anchor position. When this gets weird is when I drag the 
same bottom/top right now to the left the picture goes to 0,0 is seems and 
doesn't redraw to the left/up/down at that point.

Also When I drag Left Bottom left and top left it doesn't show. But I can cross 
over to the Right/Top Right and it shows. The H is pos and neg while W is 
always Pos. However again when I drag to the left/top left the image is not 
drawn.

Does that make sense? 

Thanks again Tim!      
_________________
Mike Cotrone - CCIE #8411 R&S, CCIE #8411 Voice
Chief Technology Officer 
Onepath Systems, LLC

Real Studio 2012 R2.1 Enterprise, Mac OS, Windows, Ubuntu Linux  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to