DC_MergeGetLists

This forum is for eXpress++ general support.
Post Reply
Message
Author
c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

DC_MergeGetLists

#1 Post by c-tec »

Hello Roger,
I want to add getlistelements dynamically, it works fine with tabpages, but when adding a simple button I get a new window only with the button. This window cannot get closed. What's wrong in my code ?
regards
Rudolf

Code: Select all


DCHOTKEY xbeK_ALT_F12    ACTION {||addbutton(Getlist),dc_getrefresh(getlist)}
...


function addbutton(aGetlist)
******************************************************************
local getlist := {}
@ 3,1 dcpushbuttonxp caption "test" size 10,1 ACTION {||piep()}
DCREAD GUI EXIT
return DC_MergeGetLists(aGetList,GetList)


------------------------------------------------------------------------------
ERROR LOG of "V:\FormCommander\sysmon.exe" Date: 17-05-2013 09:33:37

Xbase++ version : Xbase++ (R) Version 1.90.355
Operating system : Windows Vista 06.01 Build 07600
------------------------------------------------------------------------------
oError:args :
-> VALTYPE: U VALUE: NIL
oError:canDefault : N
oError:canRetry : N
oError:canSubstitute: J
oError:cargo : NIL
oError:description : Parameter has a wrong data type
oError:filename :
oError:genCode : 2
oError:operation : len
oError:osCode : 0
oError:severity : 2
oError:subCode : 3
oError:subSystem : BASE
oError:thread : 5
oError:tries : 0
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Called from DC_MERGEGETLISTS(11674)
Called from ADDBUTTON(141)
Called from (B)FCDESIGNER(75)
Called from _PROCESSHOTKEY(5287)
Called from DC_GETLIST:EVENTLOOP(4533)
Called from DC_GETLIST:READGUI(3677)
Called from DC_READGUI(101)
Called from FCDESIGNER(122)
Called from (B)SYSMONSTAT(3658)
Called from DC_XBPPUSHBUTTONXP:ACTION(1409)
Called from (B)DC_XBPPUSHBUTTONXP:INIT(214)
Called from XBPPUSHBUTTON:HANDLEEVENT(964)
Called from DC_GETLIST:EVENTLOOP(4453)
Called from DC_GETLIST:READGUI(3677)
Called from DC_READGUI(101)
Called from SYSMONSTAT(3687)
Called from (B)TASKBARMENU(1499)

DBE Component Data :FOXDBE
DBE Component Order:CDXDBE
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

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

Re: DC_MergeGetLists

#2 Post by rdonnay »

The below code is an example of how to use DC_MergeGetLists().

Make sure to pass a parent and to use the SAVE clause of DCREAD GUI.
Also, make sure that it can only be called once.

Code: Select all

#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], lButtonAdded := .f., oDlg

@ 0,0 DCSAY 'Press Alt-F12 to Add a New Button' SAYSIZE 0 FONT '12.Lucida Console Bold'

DCHOTKEY xbeK_ALT_F12 ;
   ACTION {||AddButton(Getlist,oDlg),DC_GetRefresh(Getlist),lButtonAdded := .t.} ;
   WHEN {||!lButtonAdded}

DCREAD GUI TITLE 'Merge Test' PARENT @oDlg

RETURN nil

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

function addbutton(aGetlist,oDlg)

local getlist[0]

@ 3,1 dcpushbutton caption "New Button" size 20,2 ;
      ACTION {||MsgBox('I am a new button')} ;
      FONT '12.Arial Bold'

DCREAD GUI PARENT oDlg:drawingArea EXIT SAVE

return DC_MergeGetLists(aGetList,GetList)

* ----------

PROC appsys ; RETURN
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: DC_MergeGetLists

#3 Post by c-tec »

Hello Roger,
thank you, I forgot the SAVE clause. But it works also perfect when calling it more than one time. Why do you think that it is not possible ? I want to make a designer where I can add elements dynamically.
regards
Rudolf

Code: Select all

static function addbutton(aGetlist,oDlg)
******************************************************************
static nCol
local getlist := {}
default nCol to 3
@ 3,nCol dcpushbuttonxp caption "test " + ntrim(nCol) size 10,1 ACTION {||piep()}
DCREAD GUI PARENT oDlg:drawingArea EXIT SAVE
nCol += 11
return DC_MergeGetLists(aGetList,GetList)
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

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

Re: DC_MergeGetLists

#4 Post by rdonnay »

You can call it more than one time but then you will be stacking buttons on top of each other.

That is a huge waste of memory.
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: DC_MergeGetLists

#5 Post by c-tec »

Hello Roger,
this is no problem for me, no getlistelement has the same coordiantes, this I can check bevore adding the getlistelement.
I will test how many elements are possible till I get a memory problem.
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

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

Re: DC_MergeGetLists

#6 Post by rdonnay »

We are not communicating here.

I'm saying that you want to make sure you don't create the same object on the screen more than 1 time.
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: DC_MergeGetLists

#7 Post by c-tec »

Hello Roger,
ok, I understand , but I never woud create so much buttons on the same coordinates that memory goes out ;-) I am working since the first version of eXpress++, but still discovering fascinating new possibilities. I have made a form designer with Scribus, where I display the the form a user creates parallel in a eXpress++ dialog in real time. So adding a new element results immediatly in appering a getelement in a eXpress++ dialog. When I would do this in pure Xbase++, it would be impossible for me, so it are only a few lines of code. I will post a video if I am ready with this module in my software.
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

Post Reply