Reply To: Problem whith my program in interface page

Home Forums Problems and solutions in GDL Graphical UI and parameters list Problem whith my program in interface page Reply To: Problem whith my program in interface page

#1543
Csilla Mai
Keymaster

Hi Tonio,

If the Surface parameters are handled as strings in an array, it is not possible to check their values. Neither is possible to check whether they are hidden in the caller object.
Instead I would recommend the following solution:
Create the Param and Titre arrays as a dynamic array parameter in the macro. Also all the string and material parameters you would like to handle in your macro.
When you call the macro from an object create the arrays in the User Interface script with the DIM command and fill them up with the surface parameters you would like to display. In the macro, loop through the array, until its dimension. The dimension should be given by the caller object.

MACRO:
! Loop through the array until the actual array dimension given by the caller object

for i = 1 to vardim1(Param)								
	UI_OUTFIELD 	Titre[i],	15, i * 25,	120, 	20
	UI_INFIELD{4} 	Param[i],	140,i * 25,	240,	20
next i

CALLER OBJECT:
! Arrays in the caller object for the macro, filled with the parameters used by the caller object
! The actual dimension of these arrays is given by the caller object (below)

dim Param[4]									
	Param[1] = "MaterialAttribute_1"
	Param[2] = "MaterialAttribute_2"
	Param[3] = "MaterialAttribute_4"
	Param[4] = "MaterialAttribute_5"

dim Titre[4]
	Titre[1] = title1
	Titre[2] = title2
	Titre[3] = title4
	Titre[4] = title5

call "ui_surface_macro" parameters all Param = Param,
					Titre = Titre

Csilla Mai
Library Developer, Library Team
GRAPHISOFT SE