litrax
18th July 2012, 08:48
Hello,
I have an issue when I was trying to experiment with some graphical features.
I already scripted some rectangles with DsCgwindow (e.g. a progress bar in a session to upload and download files)

Now I thougt: How about programming some status displays like traffic lights!?
But ERPLN won't let me do this.

E.g. this code for the rectangles works:


rahmen.id = create.object(DsCgwindow, current.mwindow(),
DsNx, 17,
DsNy, 80,
DsNwidth, 20,
DsNheight, 20,
DsNborderColor, RGB.BLACK,
DsNborderWidth, 1)
update.object(rahmen.id)

frame.id = create.object(DsCgwindow, current.mwindow(),
DsNx, 18,
DsNy, 81,
DsNwidth, 20,
DsNheight, 20,
DsNinferiorPointerCursor, DSCHAND,
DsNbackground, RGB.GREEN)
update.object(frame.id)


Paints green rectangle with black frame around it. Easy.

But the code

pie.id = create.object(DsCgpPie, current.mwindow(),
DsNangle, 360,
DsNgcBackground, RGB.RED,
DsNgcFillColor, RGB.RED,
DsNgcFillStyle, GCFILLSOLID,
DsNheight, 20,
DsNwidth, 20,
DsNx, 18,
DsNy, 81
)
update.object(pie.id)


throws (to me) weird error messages at session startup (see attached hardcopy DsCgpPie_Error).

What the heck has DsCgpPie to do with this ominous DsCpopupMenu!?
Can somebody give me a hint?
Has somebody have succesfully created a DsCgpPie in a session and can describe the steps to me?

Thx, Litrax

smallboy
18th July 2012, 12:25
Hi,
maybe I'm wrong but you can not create a DscgpPie on a main window directly. You have to create a DsCgwindow on the main window and then a DscgpPie on DsCgwindow; something like:

gwin = create.object(DsCgwindow, current.mwindow(),
DsNx, 17,
DsNy, 80,
DsNwidth, 20,
DsNheight, 20,
DsNborderColor, RGB.BLACK,
DsNborderWidth, 1)
update.object(gwin)

pie.id = create.object(DsCgpPie, gwin,
DsNangle, 360,
DsNgcBackground, RGB.RED,
DsNgcFillColor, RGB.RED,
DsNgcFillStyle, GCFILLSOLID,
DsNheight, 20,
DsNwidth, 20,
DsNx, 18,
DsNy, 81
)

Regards

litrax
18th July 2012, 15:31
Thanks for the code example.
Now the error is: parent 411 of object 412 is of wrong type DsCgwindow

What does this mean? Should I use another type of graphical object as main window? Must I mention the subobject DsCgpPie in the main window?

smallboy
18th July 2012, 15:58
Hi litrax,
my previous example was a bit wrong (sorry but I can not test it at the moment...) The problem is that DscgpPier is a subobject so the code should be:

gwin = create.object(DsCgwindow, current.mwindow(),
DsNx, 17,
DsNy, 80,
DsNwidth, 20,
DsNheight, 20,
DsNborderColor, RGB.BLACK,
DsNborderWidth, 1)
pie.id = create.sub.object(gwin, DsCgpPie,
DsNx, 18,
DsNy, 81 )
update.object(gwin)

So basically you have to use create.sub.object to draw inside a DsCgwindow
(note also that first argument is gwin and not DsCgpPie)

Hope this helps!
Smallboy

litrax
18th July 2012, 16:10
O.k. Thanks.

Now my code is:

gwin = create.object(DsCgwindow, current.mwindow(),
DsNx, 17,
DsNy, 80,
DsNwidth, 20,
DsNheight, 20,
DsNborderColor, RGB.BLACK,
DsNborderWidth, 1)
pie.id = create.sub.object(gwin, DsCgpPie,
DsNangle, 360,
DsNgcFillColor, RGB.RED,
DsNgcFillStyle, GCFILLSOLID,
DsNheight, 20,
DsNwidth, 20,
DsNx, 18,
DsNy, 81)
update.object(gwin)



No errors, but no pie also.!?

I'll read the docu again and test al little bit.
Tomorrow I will send my results.
Thanks for now...

smallboy
18th July 2012, 16:16
please note that with your code you create a DsCgwindow of dimension 20x20 and inside this you create a Pie also 20x20 but in position x=18 e y=81 so not in the visible area; try this

pie.id = create.sub.object(gwin, DsCgpPie,
DsNangle, 360,
DsNgcFillColor, RGB.RED,
DsNgcFillStyle, GCFILLSOLID,
DsNheight, 20,
DsNwidth, 20,
DsNx, 1,
DsNy, 1)


does it works?

litrax
18th July 2012, 16:38
Aaah! Now I understand.
It works!
Thaaaanxxx a lot... :D