Presentation space in main window of xdemo.

This forum is for eXpress++ general support.
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Presentation space in main window of xdemo.

#11 Post by rdonnay »

I think this is what you want:

Compile and run this sample:

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], oGraStatic, bPaint

bPaint := {|a,b,o|PaintGraStuff(oGraStatic)}

@ 5,5 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT OBJECT oGraStatic SIZE 600,600 PIXEL ;
      EVAL {|o|o:paint := bPaint} ;
      COLOR nil, GRA_CLR_BACKGROUND

DCSETPARENT TO oGraStatic

@ 40,40 DCPUSHBUTTONXP CAPTION 'Button 1' SIZE 200,200 PIXEL ;
        EVAL {|o|o:paint := bPaint} ;
        RADIUS 200

@ 290,40 DCPUSHBUTTONXP CAPTION 'Button 2' SIZE 200,200 PIXEL ;
        EVAL {|o|o:paint := bPaint} ;
        RADIUS 200

@ 40,290 DCPUSHBUTTONXP CAPTION 'Button 3' SIZE 200,200 PIXEL ;
        EVAL {|o|o:paint := bPaint} ;
        RADIUS 200

@ 290,290 DCPUSHBUTTONXP CAPTION 'Button 4' SIZE 200,200 PIXEL ;
        EVAL {|o|o:paint := bPaint} ;
        RADIUS 200

DCREAD GUI FIT

RETURN nil

PROC appsys ; RETURN

* ----------

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: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Presentation space in main window of xdemo.

#12 Post by skiman »

Hi Roger,

I tried it, but the result is a line that goes through the button.
testsample.PNG
testsample.PNG (8.14 KiB) Viewed 12924 times
I think it won't be possible, unless the begin and endpoint of the line is calculated. But this is something that would take a lot of calculation to define the point where the line is cutting the edge of the button. That will be too much work and probably a nightmare on different screen resolutions.

Making buttons with RADIUS:=0 would make this a lot easier. However I like the round buttons with the border.

Anyway, thanks for the suggestions.
Best regards,

Chris.
www.aboservice.be

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

Re: Presentation space in main window of xdemo.

#13 Post by rdonnay »

I assumed that you were drawing the lines to the edge of the button, not from the center of the button.
I was only trying to show you how to do the repaint.
Before I put any more time in this, I need to know exactly what you want.
Is this what you want? If it is, then it will require making changes to _DCXBUTT.PRG.
The eXpress train is coming - and it has more cars.

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

Re: Presentation space in main window of xdemo.

#14 Post by skiman »

Hi Roger,

I will try to explain with some simple images I made with paint. This is the kind of result I want.
sampleok.png
sampleok.png (5.85 KiB) Viewed 12902 times
There is a sales button, and there is a line from the center of the sales to the center of the other buttons.

Below the butons where the yellow square stands for the square that is used by GRABOX to draw the button.
sample.png
sample.png (6.2 KiB) Viewed 12902 times
Each time the button is redrawn, the GRABOX is executed, and the part of the line that is somewhere in that square is overdrawn. In the next sample you see what would happen if the mouse hovered above the delivery button.
sampleafterredrawn.png
sampleafterredrawn.png (6.17 KiB) Viewed 12902 times
To solve this the dcpushbuttonxp would have to redraw the lost part of the line. Since the DRAW method uses the GRABOX function, this will not be possible.

Changing the button class to use the GRAARC in this case, could solve this problem. However this can't be use for square buttons with rounded corners, which will have the same problem.

Don't spend time on it! It will be too much work, and it will be difficult to find a solution which will work in all cases.

Thanks for the previous suggestions. Remember what Bobby wrote on your birthday. Sometimes you need to say NO, and not always say YES. Some customers won't appreciate, but don't worry, I can handle it. :D
Best regards,

Chris.
www.aboservice.be

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

Re: Presentation space in main window of xdemo.

#15 Post by rdonnay »

A new class may be the best solution.

It can be based on DC_XbpPushButtonXP() but would draw a full set of buttons.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Presentation space in main window of xdemo.

#16 Post by Auge_Ohr »

skiman wrote:I will try to explain with some simple images I made with paint. This is the kind of result I want.
what about using a "Mask" to get "round" Buttons ?

Code: Select all

   hRgn := CreateEllipticRgn(nLeftRect,nTopRect,nRightRect,nBottomRect)
   SetWindowRgn(hHwnd,hRgn,.t.)
i have show some Tricks on German Devcon 2016 how to "pimp my Xbase++ Parts" with simple API calls.
Buttons.zip
Source "pure" Xbase++ with/without API calls
(266.07 KiB) Downloaded 737 times
start EXE with/without Parameter to show difference
greetings by OHR
Jimmy

User avatar
hz_scotty
Posts: 107
Joined: Thu Jan 28, 2010 8:20 am
Location: Wr.Neustadt / Österreich

Re: Presentation space in main window of xdemo.

#17 Post by hz_scotty »

Need DEMO.RES :clap:
best regards
Hans

User avatar
hz_scotty
Posts: 107
Joined: Thu Jan 28, 2010 8:20 am
Location: Wr.Neustadt / Österreich

Re: Presentation space in main window of xdemo.

#18 Post by hz_scotty »

MultiPb Error - see LOG

Code: Select all

Xbase++ Version     : Xbase++ (R) Version 1.90.355
Betriebssystem      : Windows 8 06.02 Build 09200
------------------------------------------------------------------------------
oError:args         :
          -> VALTYPE: O CLASS: RootCrt
oError:canDefault   : N
oError:canRetry     : N
oError:canSubstitute: J
oError:cargo        : NIL
oError:description  : Methode ist fr dieses Objekt unbekannt
oError:filename     : 
oError:genCode      :         23
oError:operation    : CurrentSize
oError:osCode       :          0
oError:severity     :          2
oError:subCode      :       2220
oError:subSystem    : BASE
oError:thread       :          1
oError:tries        :          0
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Aufgerufen von MAIN(11)

best regards
Hans

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Presentation space in main window of xdemo.

#19 Post by Auge_Ohr »

hz_scotty wrote:MultiPb Error - see LOG

Code: Select all

oError:args         :
          -> VALTYPE: O CLASS: RootCrt
oError:description  : Methode ist fr dieses Objekt unbekannt
oError:operation    : CurrentSize
sorry wrong *.XPJ Files ...
but i think you can fix it yourself ;-)
greetings by OHR
Jimmy

User avatar
hz_scotty
Posts: 107
Joined: Thu Jan 28, 2010 8:20 am
Location: Wr.Neustadt / Österreich

Re: Presentation space in main window of xdemo.

#20 Post by hz_scotty »

this fixed :dance:

but need ..\demo.res -> see PROJECT.XPJ :clap:
best regards
Hans

Post Reply