Autoresize with XBPDLG_FRAMESTAT_MAXIMIZED)

This forum is for eXpress++ general support.
Message
Author
ampandya
Posts: 58
Joined: Tue Apr 19, 2016 4:48 am

Re: Autoresize with XBPDLG_FRAMESTAT_MAXIMIZED)

#11 Post by ampandya »

Hi Roger,
did you check the buttonxp program open maximised?

was it blinking when the screen maximized?

Thanks
Ankit

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

Re: Autoresize with XBPDLG_FRAMESTAT_MAXIMIZED)

#12 Post by rdonnay »

Sorry, I have been away on a vacation.

I see what you are complaining about.

I will look into the matter today.
The eXpress train is coming - and it has more cars.

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

Re: Autoresize with XBPDLG_FRAMESTAT_MAXIMIZED)

#13 Post by rdonnay »

I think I have a solution to your problem.

The BUTTONXP sample program is using the AUTORESIZE clause of DCGETOPTIONS.

This was a very old resizing option that was added to eXpress++ about 13 years ago.

Since that time, I improved the resizing system of eXpress++ and it has a new design which uses resizing rules.

The new system does not have the flicker problem.

Change this:

DCGETOPTIONS ;
AUTORESIZE

To this:

DCGETOPTIONS ;
RESIZE RESIZEDEFAULT DCGUI_RESIZE_AUTORESIZE
The eXpress train is coming - and it has more cars.

ampandya
Posts: 58
Joined: Tue Apr 19, 2016 4:48 am

Re: Autoresize with XBPDLG_FRAMESTAT_MAXIMIZED)

#14 Post by ampandya »

Many Many Thanks Roger,
this makes a lot different in flickering.

Thanks
Ankit

ampandya
Posts: 58
Joined: Tue Apr 19, 2016 4:48 am

Re: Autoresize with XBPDLG_FRAMESTAT_MAXIMIZED)

#15 Post by ampandya »

HI

DCGETOPTIONS ;
RESIZE RESIZEDEFAULT DCGUI_RESIZE_AUTORESIZE

Was really helpful but now when i use Gradient 1.5 on the button it creates all buttons slowly slowly, there are 42 buttons and one button to go to another screen where there are more buttons.

is there any way to use gradient effect?

Thanks

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

Re: Autoresize with XBPDLG_FRAMESTAT_MAXIMIZED)

#16 Post by rdonnay »

When I originally designed DCPUSHBUTTONXP (based on owner drawing), Xbase++ Gra*() functions did not support Gradients, therefore I had to create gradients using multiple calls to GraLine() or GraBox().

If you look at the source in _DCXBUTT.PRG (line 873), the DC_XbpPushbuttonXP() class supports a custom gradient code block.

I will write a sample program to show how to use this.
The eXpress train is coming - and it has more cars.

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

Re: Autoresize with XBPDLG_FRAMESTAT_MAXIMIZED)

#17 Post by rdonnay »

Here is an example of using oConfig:gradientBlock that employs GraGradient() to paint the gradient.
If you resize the screen you will see how fast it will paint 200 buttons.

If you put a comment before oConfig:gradientBlock := {|oButton,oPS,mp2,nMode|PaintGradient(oButton,oPs,mp2,nMode)} then it
will use the default gradient system which paints gradients much slower.

Try experimenting with this to improve resize performance.

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], GetOptions, oConfig, i, j, oButton, bGradientBlock

oConfig := DC_XbpPushButtonXPConfig():new()
oConfig:fgColor := GRA_CLR_WHITE
oConfig:bgColor := GRA_CLR_CYAN
oConfig:font := '10.Arial Bold'
oConfig:gradientStyle := 4

oConfig:gradientBlock := {|oButton,oPS,mp2,nMode|PaintGradient(oButton,oPs,mp2,nMode)}

FOR i := 1 to 20
   FOR j := 1 TO 10
     @ i*22, j*102 DCPUSHBUTTONXP CAPTION 'Button' SIZE 100,20 ;
       CONFIG oConfig ;
       GRADIENT 1 ;
       ACTION {||Msgbox("activated")}
   NEXT j
NEXT i

DCGETOPTIONS ;
   PIXEL ;
   RESIZE RESIZEDEFAULT DCGUI_RESIZE_AUTORESIZE

DCREAD GUI FIT TITLE 'Gradient Test' OPTIONS GetOptions

RETURN nil

* ----------

PROC appsys ; RETURN

* ----------

STATIC FUNCTION PaintGradient( oButton, oPS, mp2, nMode )

LOCAL aColor

IF BAND(mp2[3],XBP_DRAWSTATE_SELECTED) != 0
  aColor := {GRA_CLR_RED, GRA_CLR_DARKRED}
ELSEIF oButton:mouseMode $ { 0,2 }
  aColor := {GRA_CLR_CYAN,GRA_CLR_DARKCYAN}
ELSEIF oButton:mouseMode == 1
  aColor := {GRA_CLR_DARKCYAN,GRA_CLR_CYAN}
ENDIF

GraGradient( oPS, {0,0}, {oButton:currentSize()}, aColor )

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

ampandya
Posts: 58
Joined: Tue Apr 19, 2016 4:48 am

Re: Autoresize with XBPDLG_FRAMESTAT_MAXIMIZED)

#18 Post by ampandya »

Thank you very much

you are a Genius!

This works super fast.

The only problem i am experiencing is, I can not pick up the button colour from the dbf file!

It only picks up the first button colour and applies to all?

Thanks

ampandya
Posts: 58
Joined: Tue Apr 19, 2016 4:48 am

Re: Autoresize with XBPDLG_FRAMESTAT_MAXIMIZED)

#19 Post by ampandya »

More about this..

If i use:

oConfig:bgColor := tkeys->bcolour

and remove the aColor from the GraGradient it looks like the attached image : (the second default colour is white)

Thanks
Attachments
Capture.JPG
Capture.JPG (126.25 KiB) Viewed 15577 times

Post Reply