[WD20] Is it possible to ControlCreate() in a Report?

Startbeitrag von Curtis am 10.07.2015 16:05

Is it possible to create controls in a Report? I have a report I want to run with lots of totals, but I don't know how many item totals there will be. I've tried using the following code in the opening of the report, reading the data, initializing body, and before printing body. I get an error every time:

Error at line 2 of Before printing BODY process.
ControlCreate function called.
No current window for creating .
Specify a full name.

FOR i = 1 _TO_ ArrayCount(arrTotals)
ControlCreate("ITEM_" + i,typStatic,50+nOffSet,50+nOffSet,100,24)
{"ITEM_"+i,indControl} = arrTotals[i,1]
nOffSet += 30


As far as i know ControlCreate only works for window controls.
In reports you can use ControlClone, in this case you must have at least one control of this type in the report and you can copy it as many times as you need.
You can change the properties of the new control, by instance the original control is invisible and you need the new ontrol to be visible.

Almost 80% of all the prints in our apps are using the same report based on ControlClone.


von Paulo Oliveira - am 10.07.2015 16:19
Thank you! I'm surprised you can use clone, but not create.

von Curtis - am 10.07.2015 16:27
Yes it's strange but controlclone exists since version 9 and controlcreate born only in version 19.

Maybe in some future version but if it changes at the same speed probably in version 29.;)

von Paulo Oliveira - am 10.07.2015 16:32
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.