Presentation space in main window of xdemo.

This forum is for eXpress++ general support.
Message
Author
skiman
Posts: 1194
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Presentation space in main window of xdemo.

#1 Post by skiman »

Hi,

I want to use some GRA functions to create some graphics in my main window. I don't succeed to define the correct presentation space.
At line 190 I added the following to xdemo.prg.

Code: Select all

aLineAttrib := Array( GRA_AL_COUNT )
aLineAttrib[GRA_AL_WIDTH] := 3
aLineAttrib[GRA_AL_COLOR] := 28555199
oPS     := XbpPresSpace():new()  // it looks as creating a presentation space doesn't work.
graSetAttrLine( oPS, aLineAttrib )
oPs:lockPS()
graLine( oPS, { 50,50 },{  500,500 }  )	
oPs:unlockPS()
I'm getting the following error:

Code: Select all

Error BASE/2220
Description : Object has no method with this name
Operation : lockPS
Thread ID : 1
Anyone with a solution for this?
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4745
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Presentation space in main window of xdemo.

#2 Post by rdonnay »

Chris -

If you want to paint Gra() functions you need to do it after the dialog window is created.
You are trying to do this before the window is created.
This is possible by using DCGRA* commands added to the GetList but I would suggest doing it as below because you can then call any Gra*() functions you wish.

Add the following to your DCREAD GUI EVAL code block:

Code: Select all

  o:drawingArea:paint := {|a,b,o|PaintGraStuff(o)} 
Add the following function:

Code: Select all

STATIC FUNCTION PaintGraStuff( oDrawingArea )

LOCAL aLineAttrib, oPS

aLineAttrib := Array( GRA_AL_COUNT )
aLineAttrib[GRA_AL_WIDTH] := 3
aLineAttrib[GRA_AL_COLOR] := 28555199
oPS := oDrawingArea:lockPS()
graSetAttrLine( oPS, aLineAttrib )
graLine( oPS, { 50,50 },{  500,500 }  )
oDrawingArea:unlockPS()

RETURN nil
The eXpress train is coming - and it has more cars.

skiman
Posts: 1194
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Presentation space in main window of xdemo.

#3 Post by skiman »

Hi Roger,

Thanks, this works.

I want to create some kind of organigram with buttons and lines between them. I was planning to use GRALINE to draw lines from the center of one button to another button. Since I'm using rounded corners, some part of the line disappears as soon as the button receives focus.

Also when opening another dialog in another thread, the line appears on that dialog as soon as you move this. See below for the result.

It looks as this will be not so easy to implement. Adding a line clause to the dcpushbuttonXp method could be a solution, I will check this. I suppose the presentation space should be the workarea of the parent in that case.
Attachments
grastuff.PNG
grastuff.PNG (13.68 KiB) Viewed 14716 times
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4745
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Presentation space in main window of xdemo.

#4 Post by rdonnay »

I didn't test for that.

You are correct.
I am seeing the same problem.
This may take some work to figure out how to prevent this.
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4745
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Presentation space in main window of xdemo.

#5 Post by rdonnay »

This works for me. Put a STATIC on the main window and draw on the static instead of the dialog drawingArea.

Code: Select all

@ 5,5 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT OBJECT oGraStatic SIZE 400,400 PIXEL ;
      EVAL {|o|o:paint := {|a,b,o|PaintGraStuff(o)}}
The eXpress train is coming - and it has more cars.

skiman
Posts: 1194
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Presentation space in main window of xdemo.

#6 Post by skiman »

Roger,

I created a menusystem with pushbuttons, and now I would like to connect the different buttons with a line.
menusystem.PNG
menusystem.PNG (26.51 KiB) Viewed 14711 times
If I could add a LINE to the dcpushbuttonxp command, this could work. I can add the graline to the draw method.

The oPS that is used in the pushbuttonxp:draw() method is for the space that is reserved for the button. I can't draw on another position.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4745
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Presentation space in main window of xdemo.

#7 Post by rdonnay »

The oPS that is used in the pushbuttonxp:draw() method is for the space that is reserved for the button. I can't draw on another position.
Yes, this is correct.

I'm not sure what you want to do.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1194
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Presentation space in main window of xdemo.

#8 Post by skiman »

rdonnay wrote:
Yes, this is correct.

I'm not sure what you want to do.
I want to connect the buttons with a line. This way it would show which buttons are related to each other. See it as an organigram.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4745
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Presentation space in main window of xdemo.

#9 Post by rdonnay »

I understand that but I don't understand why you would want to add it to the dcpushbutton command.

You will need to draw the lines on the drawingarea of the window which contains the pushbuttons.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1194
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Presentation space in main window of xdemo.

#10 Post by skiman »

The following problem arise.

When you HOVER above the button, the :draw() method is called. The corners are also 'repainted' and this will erase the line that should appear there. If the line could be drawn during the draw method of the button, maybe it could be solved.
line_in_corner.PNG
line_in_corner.PNG (2.95 KiB) Viewed 14708 times
You can see that the line is 'overpainted' by the draw method of the button. This would work if radius is set to zero so the result are square buttons.
Best regards,

Chris.
www.aboservice.be

Post Reply