During the creation of a tool I tried to draw manually a line in the Xojo IDE on a canvas. I noticed the next weird behavior:
No matter what I try, the line only goes from the left upper corner to the right lower corner. I am not able to draw the line manually from upper right to lower left.
It does also not matters if I use another corner to drag the end line point up or down, the line becomes horizontal and than again left upper to right lower.
Anybody does notice the same behavior? Is this a known bug in Xojo?
The used DrawLine code would help to give an answer. Just in case it can help, here you have the syntax:
PS: I know I have troubles when it comes to resize an image, so I always copy the syntax and paste it in the line just before the one where I have to use it. Usually all goes fine when I do that ;-
You are talking about that Line control right?
I don’t think you can ‘draw’ with it but it has x and y values you can set in the inspector.
Instead of trying to drag/draw it in position, you can set the X2 and the Y2 to the top right corner and the X1 and Y1 to the bottom left corner.
But, if it’s a canvas, why not draw the lines yourself in the Paint event? (or circles, or squares etc.)
I find that way easier and it probably won’t flicker on Windows
g.DrawLine (g.Width, 0, 0, g.Height )
…in the paint event.
Emile and Marco, thanks for your answer.
Indeed, you cannot draw a line correctly while in designing mode with the line decoration or at least not position the line correctly from lower left to upper right. I had to adjust the values manually, so it is better to draw the line with code.
I have the same problem. I have dozens of these lines in the IDE. For me it’s not a solution to draw these lines programmatically because I use its coordinates as a reference to a underlaying picture; they represent obstacles where a ball should bounce and are not visible when the program runs.
Thats not a reason not to do that.
If they are not visible, then you must know what the start and end points are.
Why not create a class with properties X1,Y1 and X2, Y2
then have an array or dictionary of those?
@ Jeff Tullin
Hi Jeff. In a pinball-like game I have a perfect picture of a playfield. In the IDE I draw on top of this picture lines and circles, whose coordinates I use to detect collisions in my running programthe lines and circles itself stay invisible. But it would be nice to see what I’m doing in the IDE. Your idea of a class, a subclass of Canvas or so, would be my final, least favorite, solution.