Tweaking the wall, part 2/3: Using the graphics drawing interface

Edit: This post concerns “The Wall”, a discontinued project.

The BeforUpdate and AfterUpdate callback functions are basically used to allow custom graphics to be drawn below or above it. The graphics drawing interface is passed as an argument to the function you register as a callback function. Again, this Is the Hello World application of The Wall:

BackgroundColor = "#445566"
RegisterTextItem 0, "A", 4, 4, "#aabbcc", "InitializeText"

Sub InitializeText(ByVal Item)
   Item.Value = "Hello World!"
End Sub

This is what we get:

Hello World!

No, let’s say that I want to draw something before and after the text item that I have registered in the above code, I would have to register these two callback methods too, like so:

BackgroundColor = "#000000"
RegisterTextItem 0, "A", 1, 1, "#00ff00", "InitializeText"

BeforeUpdate "MyBeforeFunction"
AfterUpdate "MyAfterFunction"

Sub MyBeforeFunction(ByVal G)
   'TODO: Use the graphics drawing interface here!
End Sub

Sub MyAfterFunction(ByVal G)
   'TODO: Use the graphics drawing interface here!
End Sub

Sub InitializeText(ByVal Item)
   Item.Value = "Hello World!"
End Sub

Any drawing done in MyBeforeFunction will appear behind the text Hello World! since MyBeforeFunction was registered using the built in BeforeUpdate function. Any drawing done in MyAfterFunction will appear in front of the text since it was registered using the built in AfterUpdate function.

This will give us a blue rectangle behind the text, and a yellow rectangle in front of the text.

BackgroundColor = "#000000"
RegisterTextItem 0, "A", 1, 1, "#00ff00", "InitializeText"

BeforeUpdate "MyBeforeFunction"
AfterUpdate "MyAfterFunction"

Sub MyBeforeFunction(ByVal G)
   G.DrawBar "#0000ff", 0, 0, 400, 60
End Sub

Sub MyAfterFunction(ByVal G)
   G.DrawBar "#ffff00", 0, 65, 400, 60
End Sub

Sub InitializeText(ByVal Item)
   Item.Value = "Hello World!"
End Sub

Like so:

The DrawLine function accepts a color (all colors are in string format), X1, Y1, X2 and Y2. The DrawBar function accepts a color, X, Y, Width and Height, just as the DrawRectangle function.

Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll:

Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!

Comments

Important information: If you have not commented before, your comment will be reviewed before it is published. This means that you will not see it immediately, but I have received it. This is not because I want to filter comments, but because I want to prevent spam and advertising.

Leave a Reply

Your email address will not be published. Required fields are marked *