Skip to content

Object StringGridModel in WMStringGrids.Mod is now missing SetAsString*() procedure

In module WMStringGrids.Mod there is an error that makes GUI builder generate erroneous source code: GUI builder generates erroneous source code when using StringGrid component because module WMstringGrids, object StringGridModel is now missing procedure SetAsString*(CONST name: ARRAY OF CHAR); GUI builder still outputs code that is calling this procedure. Quick solution is to insert dummy procedure SetAsString*() in object StringGridModel but what is a proper solution?

My idea is as follows. When you look inside WMBuilderTransformer.Mod, in object Transformer, procedure Transform.WriteProperties.WriteReferenceProperty:

PROCEDURE WriteReferenceProperty(property : WMProperties.Property);
BEGIN
	w.String('.SetAsString("'); property.ToStream(w); w.String('");');
END WriteReferenceProperty;

then exactly this procedure generates erroneous code mentioned above. It generates code: stringGrid.model.SetAsString(""); This is because for some reason object StringGridModel is considered as 'ReferenceProperty'. Look at code at position WMBuilderTransformer.Mod@13979

					FOR i := 0 TO LEN(pa) - 1 DO
						IF ~pa[i].GetIsDefault() & (pa[i].GetName() # NIL) THEN
							name := pa[i].GetName();
							IF (name^ # "Alignment") & (name^ # "Bounds") THEN
								Indent(w, CreateFormIndent);
								GetPropertyNameAsString(pa[i], pname);
								w.String(identifier); w.String("."); w.String(pname);
								IF (pa[i] IS WMProperties.StringProperty) THEN WriteStringProperty(pa[i]);
								ELSIF (pa[i] IS WMProperties.ColorProperty) THEN WriteColorProperty(pa[i]);
								ELSIF (pa[i] IS WMProperties.BooleanProperty) THEN WriteBooleanProperty(pa[i]);
						13979-->	ELSIF (pa[i] IS WMProperties.ReferenceProperty) THEN WriteReferenceProperty(pa[i]);
								ELSIF (pa[i] IS WMProperties.FontProperty) THEN WriteFontProperty(pa[i]);
								ELSIF (pa[i] IS WMProperties.RectangleProperty) THEN WriteRectangleProperty(pa[i]);
								ELSE
									w.String(".Set("); pa[i].ToStream(w); w.String(");");
								END;
								w.Char(CHR(Texts.NewLineChar));
							END;
						END;

So if StringGridModel would not be considered as ReferenceProperty then this erroneous code would not be generated. Any idea how to solve it? How does WMBuilderTransformer decide what is a 'ReferenceProperty'?

Please let me know of the solution so that I understand more of how gui builder is generating source code for components.