Page 2 of 2

Re: Presentation space in main window of xdemo.

Posted: Fri May 19, 2017 11:46 am
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

Re: Presentation space in main window of xdemo.

Posted: Sat May 20, 2017 2:27 am
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 13308 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.

Re: Presentation space in main window of xdemo.

Posted: Sat May 20, 2017 7:00 am
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.

Re: Presentation space in main window of xdemo.

Posted: Mon May 22, 2017 10:03 am
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 13286 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 13286 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 13286 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

Re: Presentation space in main window of xdemo.

Posted: Mon May 22, 2017 10:12 am
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.

Re: Presentation space in main window of xdemo.

Posted: Mon May 22, 2017 10:37 am
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 758 times
start EXE with/without Parameter to show difference

Re: Presentation space in main window of xdemo.

Posted: Mon May 22, 2017 11:38 am
by hz_scotty
Need DEMO.RES :clap:

Re: Presentation space in main window of xdemo.

Posted: Mon May 22, 2017 11:43 am
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)


Re: Presentation space in main window of xdemo.

Posted: Mon May 22, 2017 12:20 pm
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 ;-)

Re: Presentation space in main window of xdemo.

Posted: Tue May 23, 2017 5:41 am
by hz_scotty
this fixed :dance:

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