Pens and Brush objects
Posted: Fri Oct 30, 2020 7:27 pm
Hi,
I am using the following code to draw 3 rectangles on a DataWindow,
METHOD Expose(oExposeEvent) CLASS Tab_Gantt
LOCAL oBoundingBox AS BoundingBox
LOCAL oRect AS RectangleObject
LOCAL oOrigin AS Point
oBoundingBox := IIF(oExposeEvent == NULL_OBJECT, NULL_OBJECT, oExposeEvent:ExposedArea)
SUPER:Expose(oExposeEvent)
//Put your changes here
oOrigin := SELF:oCCBtnTodayColour:Origin
oOrigin:X += 110
oRect := RectangleObject{ oOrigin, Dimension{ 29, 21 }, Pen{ Color{ SELF:Owner:aTodayColour[1], SELF:Owner:aTodayColour[2], SELF:Owner:aTodayColour[3] } }, Brush{ Color{ COLORWHITE } } }
SELF:Draw( oRect )
oOrigin := SELF:oCCBtnSelectedColour:Origin
oOrigin:X += 180
oRect := RectangleObject{ oOrigin, Dimension{ 29, 21 }, Pen{ Color{ SELF:Owner:aSelectedColour[1], SELF:Owner:aSelectedColour[2], SELF:Owner:aSelectedColour[3] } }, Brush{ Color{ COLORWHITE } } }
SELF:Draw( oRect )
oOrigin:X += 180
oRect := RectangleObject{ oOrigin, Dimension{ 29, 21 }, Pen{ Color{ SELF:Owner:aSelectedColour[1], SELF:Owner:aSelectedColour[2], SELF:Owner:aSelectedColour[3] } }, Brush{ Color{ SELF:Owner:aSelectedColour[1], SELF:Owner:aSelectedColour[2], SELF:Owner:aSelectedColour[3] } } }
SELF:Draw( oRect )
RETURN NIL
The question is, am I going to run into memory problems not specifically destroying the Pen and Brush objects by doing something like this:
oBrush := Brush{ Color{ SELF:Owner:aSelectedColour[1], SELF:Owner:aSelectedColour[2], SELF:Owner:aSelectedColour[3] } }
.... use it ....
oBrush := NULL_OBJECT
Cheers
Glen Townsley
I am using the following code to draw 3 rectangles on a DataWindow,
METHOD Expose(oExposeEvent) CLASS Tab_Gantt
LOCAL oBoundingBox AS BoundingBox
LOCAL oRect AS RectangleObject
LOCAL oOrigin AS Point
oBoundingBox := IIF(oExposeEvent == NULL_OBJECT, NULL_OBJECT, oExposeEvent:ExposedArea)
SUPER:Expose(oExposeEvent)
//Put your changes here
oOrigin := SELF:oCCBtnTodayColour:Origin
oOrigin:X += 110
oRect := RectangleObject{ oOrigin, Dimension{ 29, 21 }, Pen{ Color{ SELF:Owner:aTodayColour[1], SELF:Owner:aTodayColour[2], SELF:Owner:aTodayColour[3] } }, Brush{ Color{ COLORWHITE } } }
SELF:Draw( oRect )
oOrigin := SELF:oCCBtnSelectedColour:Origin
oOrigin:X += 180
oRect := RectangleObject{ oOrigin, Dimension{ 29, 21 }, Pen{ Color{ SELF:Owner:aSelectedColour[1], SELF:Owner:aSelectedColour[2], SELF:Owner:aSelectedColour[3] } }, Brush{ Color{ COLORWHITE } } }
SELF:Draw( oRect )
oOrigin:X += 180
oRect := RectangleObject{ oOrigin, Dimension{ 29, 21 }, Pen{ Color{ SELF:Owner:aSelectedColour[1], SELF:Owner:aSelectedColour[2], SELF:Owner:aSelectedColour[3] } }, Brush{ Color{ SELF:Owner:aSelectedColour[1], SELF:Owner:aSelectedColour[2], SELF:Owner:aSelectedColour[3] } } }
SELF:Draw( oRect )
RETURN NIL
The question is, am I going to run into memory problems not specifically destroying the Pen and Brush objects by doing something like this:
oBrush := Brush{ Color{ SELF:Owner:aSelectedColour[1], SELF:Owner:aSelectedColour[2], SELF:Owner:aSelectedColour[3] } }
.... use it ....
oBrush := NULL_OBJECT
Cheers
Glen Townsley