Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Language Reference error ? (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Sprite Surface weirness in 5.5
Next thread: [ANN] App Bundler 1.0b2


Using services   -   Jan Erik Moström <
  Language Reference error ?   -   Þór Sigurðsson <to
   Re: Language Reference error ?   -   Kevin Windham
   Re: Language Reference error ?   -   Þór Sigurðsson <to
   Re: Language Reference error ?   -   Joseph J. Strout
   Re: Language Reference error ?   -   Joseph J. Strout

Language Reference error ?
Date: 28.02.04 17:23 (Sat, 28 Feb 2004 16:23:09 +0000)
From: Þór Sigurðsson <to
Hi,

In the language reference for 5.5, page 50, there is an arc example.

I have been trying to use this example to draw a pie chart ( ok,
perhaps I'm doing it the hard way :)

the code reads:

Dim a as New ArcShape
a.arcAngle57
a.startAngle=-1.57
a.FillColor=RGB(255,0,127)
g.drawObject a,100,100

Now, I'm wondering, what does "g" reference ? I've tried self, a,
window1, placard1, oval1, canvas1...

No object seems to like the drawObject call...

Can someone hit me with a cluestick ? :)

-tosi

- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Language Reference error ?
Date: 28.02.04 17:37 (Sat, 28 Feb 2004 10:37:40 -0600)
From: Kevin Windham
g refers to a graphics context. You can get one by seeing if the object
you are drawing into has a graphics property.

Canvas is an easy one. Just use canvas1.graphics in place of g.

If you want to draw into a window, then notice the paint event of the
window. It includes a g as graphics parameter you can use to paint into
when the window draws itself.

HTH,
Kevin

On Feb 28, 2004, at 10:23 AM, Þór Sigurðsson wrote:

> Hi,
>
> In the language reference for 5.5, page 50, there is an arc example.
>
> I have been trying to use this example to draw a pie chart ( ok,
> perhaps I'm doing it the hard way :)
>
> the code reads:
>
> Dim a as New ArcShape
> a.arcAngle=1.57
> a.startAngle=-1.57
> a.FillColor=RGB(255,0,127)
> g.drawObject a,100,100
>
> Now, I'm wondering, what does "g" reference ? I've tried self, a,
> window1, placard1, oval1, canvas1...
>
> No object seems to like the drawObject call...
>
> Can someone hit me with a cluestick ? :)
>
> -tosi

- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Language Reference error ?
Date: 28.02.04 17:41 (Sat, 28 Feb 2004 16:41:20 +0000)
From: Þór Sigurðsson <to
Duh... I'll be answering myself...

This code works...

Dim a as New ArcShape
Dim g as Graphics

g=window1.graphics

a.arcAngle=1.57
a.startAngle=-1.57
a.FillColor=RGB(255,0,127)
g.drawObject a,100,100

"RTFM" pops to mind ;)

Sorry about the noise of my laziness.

-tosi

On 28.2.2004, at 16:23, Þór Sigurðsson wrote:

> Hi,
>
> In the language reference for 5.5, page 50, there is an arc example.
>
> I have been trying to use this example to draw a pie chart ( ok,
> perhaps I'm doing it the hard way :)
>
> the code reads:
>
> Dim a as New ArcShape
> a.arcAngle=1.57
> a.startAngle=-1.57
> a.FillColor=RGB(255,0,127)
> g.drawObject a,100,100
>
> Now, I'm wondering, what does "g" reference ? I've tried self, a,
> window1, placard1, oval1, canvas1...
>
> No object seems to like the drawObject call...
>
> Can someone hit me with a cluestick ? :)
>
> -tosi
>
> - - -
> Unsubscribe or switch delivery mode:
> <http://support.realsoftware.com/listmanager/>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>

- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Language Reference error ?
Date: 28.02.04 19:56 (Sat, 28 Feb 2004 12:56:51 -0600)
From: Joseph J. Strout
At 4:23 PM +0000 2/28/04, Þór Sigurðsson wrote:

>I have been trying to use this example to draw a pie chart ( ok,
>perhaps I'm doing it the hard way :)

No, ArcShape is definitely the right way to do it.

>the code reads:
>
> Dim a as New ArcShape
> a.arcAngle=1.57
> a.startAngle=-1.57
> a.FillColor=RGB(255,0,127)
> g.drawObject a,100,100
>
>Now, I'm wondering, what does "g" reference ?

A Graphics object. Such as the parameter "g" in the Paint event of a
window or canvas, which is where you should drag the above code.

>No object seems to like the drawObject call...

Did you try searching for DrawObject in the online language
reference? That should have taken you to the Graphics page (as well
as any other pages where this appeared in an example or whatnot).
But I suppose it still wouldn't have told you to put the sample code
into a Paint event.

>Can someone hit me with a cluestick ? :)

>whack!< :)

--

Re: Language Reference error ?
Date: 28.02.04 19:59 (Sat, 28 Feb 2004 12:59:15 -0600)
From: Joseph J. Strout
At 4:41 PM +0000 2/28/04, Þór Sigurðsson wrote:

> g=window1.graphics

I don't recommend this, nor do I recommend...

At 10:37 AM -0600 2/28/04, Kevin Windham wrote:
>Canvas is an easy one. Just use canvas1.graphics in place of g.

In either of these cases, you're drawing directly into the graphics
context of a window or canvas. But as a new user, you're probably
thinking that such drawing will stick around, at least long enough
for the user to see it. And that's not always true. In fact on some
OSes it's not even *often* true.

The proper place to draw something, at least as a beginner, is in a
Paint event. This event is invoked whenever whatever-it-is has just
been erased and needs to draw its content.

Cheers,
- Joe

--