what you need is the Syntaxfromsql function. You can read it more here:
for your example:
string ls_sql_syntax, ls_dw_source, ERRORS
ls_sql_syntax = "SELECT DATA, ID, COUNTRY FROM TABLE1"
ls_dw_source = SQLCA.SyntaxFromSQL(ls_sql_syntax, "Grid", ERRORS)
IF Len(ERRORS) > 0 THEN
MessageBox("Caution", "SyntaxFromSQL caused these errors: " + ERRORS)
RETURN 0
END IF
dw_work.Create( ls_dw_source, ERRORS)
IF Len(ERRORS) > 0 THEN
MessageBox("Caution", "Create cause these errors: " + ERRORS)
RETURN 0
END IF
Where we suppose that dw_work is the datawindow control's name. After creating this "basic" datawindow you can customize it at runtime with the Modify methods. You can set nearly everything (width, height, font size, color etc.)
More info here:
I hope that helps. Please feel free to ask more. We are using this dynamic datawindow concept in our project heavily.
Br. Gábor