Hello I’m trying to use the classes. I would like to have a Canvas object with multiple variables and in the Paint event pass it my values … but it doesn’t work. If I use Canvas and write messagebox in Paint, when I open the project it works … if I do it using the created class it does nothing. Where am I wrong?
Super:DesktopCanvas - select
on the CanvasEdited
Mouse Dx Key → Add Event Handler → Paint
Mouse Dx Key - > Create Event Definiton from Event
On Inspector i insert my values and edit name in PaintEdited
Ok let’s say I managed to create the class and it works, the paint event is called when I open the Window and draw a rectangle on the canvas.
Now, if I wanted to call the class created by me PaintEdited from a Method and pass values to it, how do you do it? I can’t understand the mechanism.
In Button1 Pressed for examble something like that Canvas1.Pressed(12,12) to invoke the event associated with the canvas
you would store the data in properties then you call yourcanvasinwindow.refresh
and the paint event comes. (the older event method name was .invalidate)
inside the default paint event you can call a other method and forward “g”
this methods would be placed in your subclassed canvas.
if you need to paint objects/shapes you would have a class with property selected true/false,
then you can highlight it in the paint event draw method.
if you need to select objects in your object list you would have a method with mouse x,y input,
it iterate over all objects, looks for intersection and set this selected flag.
Ok I can call the class with RaiseEvent PaintEdited(g,150,200) and update the PAINT event by calling Canvas1.refresh…then I can pass the values that interest me into the subclass … oh my what a struggle, for me it is all new Thanks for your patience.