Page 1 of 1

dc_mergegetlists() and captionarray

Posted: Sun Dec 28, 2014 12:15 pm
by c-tec
Hello,
I would like to merge getlists with buttons where the caption is definde with CAPTIONARRAY. In my sample I use the same caption array, but the result is different. What could be wrong ?
regards
Rudolf



Code: Select all

FUNCTION xxxMenu()
******************************************************************
LOCAL GetList[0],aCaption
aCaption :=  { ;
  {chr(74) , GRA_CLR_WHITE,15,15, , ,                                   ,"50.Wingdings",,}, ; // Symbol
  {"Test 1", GRA_CLR_WHITE,65,  , , ,XBPALIGN_BOTTOM + XBPALIGN_HCENTER ,"8.Arial",,}} // Label bottom
@ 1,1 DCPUSHBUTTONXP SIZE 80,80 CAPTIONARRAY aCaption PIXEL CONFIG BUCFG1 ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

getlist := DC_MergeGetLists(get_buttons(),GetList)
DCREAD GUI
RETURN nil

function get_buttons()
******************************************************************
LOCAL GetList[0],aCaption
aCaption :=  { ;
  {chr(74) , GRA_CLR_WHITE,15,15, , ,                                   ,"50.Wingdings",,}, ; // Symbol
  {"Test 2", GRA_CLR_WHITE,65,  , , ,XBPALIGN_BOTTOM + XBPALIGN_HCENTER ,"8.Arial",,}} // Label bottom
@ 1,85 DCPUSHBUTTONXP SIZE 80,80 CAPTIONARRAY aCaption PIXEL CONFIG BUCFG1 ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
DCREAD GUI EXIT SAVE
return getlist


Re: dc_mergegetlists() and captionarray

Posted: Sun Dec 28, 2014 12:44 pm
by rdonnay
Wolfgang -

You are using DC_MergeGetlists() in a way that it was not intended. You do not need to use this function to add items to a GetList in a subroutine. Look at the below code. DC_MergeGetLists() is designed to improve performance when creating large dialogs with lots of tabpages. The idea is to create dialog elements on the screen "on demand", i.e. only when the user clicks on the tabpage, and after the dialog has been already created. If you want to build dialogs from multiple subroutines, all you need to do is pass the GetList array to the subroutine.

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], aCaption
LOCAL BUCFG1 := DC_XbpPushButtonXPDefault()

BUCFG1:bgColor := GRA_CLR_DARKBLUE

aCaption :=  { ;
  {chr(74) , GRA_CLR_WHITE,60,13, , , ,"50.Wingdings",,}, ; // Symbol
  {"Test 1", GRA_CLR_WHITE,75,  , , ,XBPALIGN_BOTTOM + XBPALIGN_HCENTER ,"8.Arial",,}} // Label bottom

@ 1,1 DCPUSHBUTTONXP SIZE 80,80 CAPTIONARRAY aCaption PIXEL ;
      CONFIG BUCFG1 ;
      ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

Get_Buttons( GetList, BUCFG1 )

DCREAD GUI FIT

RETURN nil

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

function get_buttons( GetList, BUCFG1 )

LOCAL aCaption

aCaption :=  { ;
  {chr(74) , GRA_CLR_WHITE,60,13, , ,,"50.Wingdings",,}, ; // Symbol
  {"Test 2", GRA_CLR_WHITE,75,  , , ,XBPALIGN_BOTTOM + XBPALIGN_HCENTER ,"8.Arial",,}} // Label bottom

@ 1,85 DCPUSHBUTTONXP SIZE 80,80 CAPTIONARRAY aCaption PIXEL ;
       CONFIG BUCFG1 ;
       ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

return nil

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

PROC appsys ; RETURN

Re: dc_mergegetlists() and captionarray

Posted: Mon Dec 29, 2014 12:26 am
by c-tec
Hello Roger,
thank you, works perfect now. I use it already on tabpages and works also perfect, this is why I thougt that I also have to use dc_mergegetlists()
regards
Rudolf