DCPUSHBUTTONXP with array caption

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

DCPUSHBUTTONXP with array caption

#1 Post by Tom »

DCPUSHBUTTONs support an array caption with two textes, which toggle if the buttons are enabled/disabled. DCPUSHBUTTONXPs should support this aswell, but they don't. Here is a sample with a workaround:

Code: Select all

#include 'dcdialog.ch'
#pragma library("dclipx.lib")

proc main
LOCAL GetList := {}, aBez1 := {"aktiv","inaktiv"}, i := 1

/*  * Wenn nicht auskommentiert  keine Caption */
oConfig := DC_XbpPushButtonXPConfig():new()
oConfig:radius := 20
oConfig:bgColor := GRA_CLR_CYAN

* Workaround:

@ 02,12 dcpushbuttonxp caption {||abez1[IF(i=1,1,2)]} size 10,1 ;
        action {||nil} when {||i=1} config oConfig

@ 02,23 dcpushbuttonxp caption {||abez1[IF(i=2,1,2)]} size 10,1 ;
        action {||nil} when {||i=2} config oConfig

* Legacy buttons:

@ 02,34 dcpushbutton caption abez1 size 10,1 ;
        action {||nil} when {||i=1}

@ 02,45 dcpushbutton caption abez1 size 10,1 ;
        action {||nil} when {||i=2}

* ButtonsXP without workaround:

@ 02,56 dcpushbuttonxp caption abez1 size 10,1 ;
        action {||nil} when {||i=1} config oConfig

@ 02,67 dcpushbuttonxp caption abez1 size 10,1 ;
        action {||nil} when {||i=2} config oConfig


@ 04,12 DCPUSHBUTTON CAPTION 'Toggle' SIZE 10,1 ACTION {||i++,IF(i>2,i:=1,NIL),DC_GetRefresh(GetList)}

DCREAD GUI fit ADDBUTTONS

RETURN

*------------------

proc appsys
return
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

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

Re: DCPUSHBUTTONXP with array caption

#2 Post by rdonnay »

Thanks for that Tom.

I forgot that DCPUSHBUTTON even had that feature or I would have added it to DCPUSHBUTTONXP.

I'll plan to add it in next build.
The eXpress train is coming - and it has more cars.

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCPUSHBUTTONXP with array caption

#3 Post by Tom »

Thx!
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Post Reply