Tuesday, July 19, 2011

Building a simple search form

Code for a very, and I do mean, very, simple search form.


:DECLARE oUserForm, sTXT, sSoftware,sOKButtonClick,sButton4, oCSFac;

X := LimsAPICall("GetSystemMetrics","LONG",,0);
Y := LimsAPICall("GetSystemMetrics","LONG",,1);

oUserForm := UserForm{(X-400)/2,(Y-190)/2, 400, 190, "Search Catalog"};
oUserForm:AddControl({"sTXT", 15, 90, 100,25, "TEXT","Number (including zeros):" });
oUserForm:AddControl({"sSoftware",110, 90, 100, 20, "SE","",""});
oUserForm:AddControl({"sOKButtonClick", 60, 20, 80, 25, "PB", "OK"});
oUserForm:AddControl({"sButton4", 180, 20, 80, 25, "PB", "Cancel"});
oUserForm:EnableMinBox(.F.);
oUserForm:EnableMaxBox(.F.);
oUserForm:Display(.T.);

The LimsAPICall to GetSystemMetrics is a nice way to get positioning information.

Otherwise the rest of the form is built on the fly (easy to adjust that way) and then displayed.

No comments:

Post a Comment