Thanks for the tips and answers.
Each objet has its own individual modify command, I did not try to create multiple objects with a single modify command.
1 - I wanted to avoid going through the edit source and whatnot and wanted to do it programmatically and generically. read all the properties from the template, modify some, create a new object in the destination datawindow with all the properties.
what I ended up doing, it suits my need at the moment I'll try a better version later.
ll_find = this.liste_types.find("nom_objet = '" + as_nom_objet + "'",1,this.liste_types.rowCount())
if ll_find > 0 then
ls_type = this.liste_types.getItemString(ll_find,'valeur_attribut')
choose case ls_type
case 'text'
ls_ret = &
"create text(band=detail" + &
" color='"+ this.of_get_attribut(as_nom_objet,'color') + "' alignment='" + this.of_get_attribut(as_nom_objet,'alignment') + "' border='" + this.of_get_attribut(as_nom_objet,'border') + "' visible='" + this.of_get_attribut(as_nom_objet,'visible') + "'" + &
" height.autosize=" + this.of_get_attribut(as_nom_objet,'height.autosize') + " pointer='" + this.of_get_attribut(as_nom_objet,'pointer') + "' moveable=0 resizeable=0 x='" + this.of_get_attribut(as_nom_objet,'x') + "' y='" + this.of_get_attribut(as_nom_objet,'y') + "' height='" + this.of_get_attribut(as_nom_objet,'height') + "' width='"+ this.of_get_attribut(as_nom_objet,'width') + "' text='" + this.of_get_attribut(as_nom_objet,'text') + "'" + &
" name=" + this.of_get_attribut(as_nom_objet,'name') + " tag='" + this.of_get_attribut(as_nom_objet,'tag') + "' font.face='" + this.of_get_attribut(as_nom_objet,'font.face') + "' font.height='" + this.of_get_attribut(as_nom_objet,'font.height') + "' font.weight='" + this.of_get_attribut(as_nom_objet,'font.weight') + "' font.family='" + this.of_get_attribut(as_nom_objet,'font.family') + "' font.pitch='" + this.of_get_attribut(as_nom_objet,'font.pitch') + "' font.charset='" + this.of_get_attribut(as_nom_objet,'font.charset') + "' font.italic='" + this.of_get_attribut(as_nom_objet,'font.italic') + "' font.strikethrough='" + this.of_get_attribut(as_nom_objet,'font.strikethrough') + "' font.underline='" + this.of_get_attribut(as_nom_objet,'font.underline') + "' background.mode='" + this.of_get_attribut(as_nom_objet,'background.mode') + "' background.color='" + this.of_get_attribut(as_nom_objet,'background.color') + "')"
case 'bitmap'
ls_ret = &
"create bitmap(band=Detail pointer='" + this.of_get_attribut(as_nom_objet,'pointer') + "' visible='" + this.of_get_attribut(as_nom_objet,'visible') + "'" + &
" moveable=0 resizeable=0 x='" + this.of_get_attribut(as_nom_objet,'x') + "' y='" + this.of_get_attribut(as_nom_objet,'y') + "' height='" + this.of_get_attribut(as_nom_objet,'height') + "' width='" + this.of_get_attribut(as_nom_objet,'width') + "'" + &
" filename='" + this.of_get_attribut(as_nom_objet,'filename') + "' name=" + this.of_get_attribut(as_nom_objet,'name') + "" + &
" tag='" + this.of_get_attribut(as_nom_objet,'tag') + "')"
case 'rectangle'
ls_ret = &
"create rectangle(band=Detail" + &
" pointer='" + this.of_get_attribut(as_nom_objet,'pointer') + "' moveable=0 resizeable=0 x='" + this.of_get_attribut(as_nom_objet,'x') + "' y='" + this.of_get_attribut(as_nom_objet,'y') + "' height='" + this.of_get_attribut(as_nom_objet,'height') + "' width='" + this.of_get_attribut(as_nom_objet,'width') + "' name=" + this.of_get_attribut(as_nom_objet,'name') + " visible='" + this.of_get_attribut(as_nom_objet,'visible') + "'" + &
" tag='" + this.of_get_attribut(as_nom_objet,'tag') + "' brush.hatch='" + this.of_get_attribut(as_nom_objet,'brush.hatch') + "'" + &
" brush.color='" + this.of_get_attribut(as_nom_objet,'brush.color') + "' pen.style='" + this.of_get_attribut(as_nom_objet,'pen.style') + "' pen.width='" + this.of_get_attribut(as_nom_objet,'pen.width') + "' pen.color='" + this.of_get_attribut(as_nom_objet,'pen.color') + "' background.mode='" + this.of_get_attribut(as_nom_objet,'background.mode') + "' background.color='" + this.of_get_attribut(as_nom_objet,'background.color') + "')"
case 'roundrectangle'
ls_ret = &
"create roundrectangle(band=Detail" + &
" pointer='" + this.of_get_attribut(as_nom_objet,'pointer') + "' moveable=0 resizeable=0 x='" + this.of_get_attribut(as_nom_objet,'x') + "' y='" + this.of_get_attribut(as_nom_objet,'y') + "' height='" + this.of_get_attribut(as_nom_objet,'height') + "' width='" + this.of_get_attribut(as_nom_objet,'width') + "' name=" + this.of_get_attribut(as_nom_objet,'name') + " visible='" + this.of_get_attribut(as_nom_objet,'visible') + "'" + &
" ellipseheight='" + this.of_get_attribut(as_nom_objet,'ellipseheight') + "' ellipsewidth='" + this.of_get_attribut(as_nom_objet,'ellipsewidth') + "'" + &
" tag='" + this.of_get_attribut(as_nom_objet,'tag') + "' brush.hatch='" + this.of_get_attribut(as_nom_objet,'brush.hatch') + "'" + &
" brush.color='" + this.of_get_attribut(as_nom_objet,'brush.color') + "' pen.style='" + this.of_get_attribut(as_nom_objet,'pen.style') + "' pen.width='pen.width' pen.color='" + this.of_get_attribut(as_nom_objet,'pen.color') + "' background.mode='" + this.of_get_attribut(as_nom_objet,'background.mode') + "' background.color='" + this.of_get_attribut(as_nom_objet,'background.color') + "')"
case 'compute'
ls_ret = &
"create compute(band=Detail" + &
" color='" + this.of_get_attribut(as_nom_objet,'color') + "' alignment='" + this.of_get_attribut(as_nom_objet,'alignment') + "' border='" + this.of_get_attribut(as_nom_objet,'border') + "' visible='" + this.of_get_attribut(as_nom_objet,'visible') + "'" + &
" height.autosize=" + this.of_get_attribut(as_nom_objet,'height.autosize') + " pointer='" + this.of_get_attribut(as_nom_objet,'pointer') + "' moveable=0 resizeable=0 x='" + this.of_get_attribut(as_nom_objet,'x') + "' y='" + this.of_get_attribut(as_nom_objet,'y') + "' height='" + this.of_get_attribut(as_nom_objet,'height') + "' width='" + this.of_get_attribut(as_nom_objet,'width') + "' format='" + this.of_get_attribut(as_nom_objet,'format') + "'" + &
" name=" + this.of_get_attribut(as_nom_objet,'name') + " tag='" + this.of_get_attribut(as_nom_objet,'tag') + "' expression='" + this.of_get_attribut(as_nom_objet,'expression') + "' font.face='" + this.of_get_attribut(as_nom_objet,'font.face') + "' font.height='" + this.of_get_attribut(as_nom_objet,'font.height') + "' font.weight='" + this.of_get_attribut(as_nom_objet,'font.weight') + "' font.family='" + this.of_get_attribut(as_nom_objet,'font.family') + "' font.pitch='" + this.of_get_attribut(as_nom_objet,'font.pitch') + "' font.charset='" + this.of_get_attribut(as_nom_objet,'font.charset') + "' font.italic='" + this.of_get_attribut(as_nom_objet,'font.italic') + "' font.strikethrough='" + this.of_get_attribut(as_nom_objet,'font.strikethrough') + "' font.underline='" + this.of_get_attribut(as_nom_objet,'font.underline') + "' background.mode='" + this.of_get_attribut(as_nom_objet,'background.mode') + "' background.color='" + this.of_get_attribut(as_nom_objet,'background.color') + "')"
case 'column'
choose case this.of_get_attribut(as_nom_objet,'edit.style')
case 'edit'
ls_ret = &
"create column(id=" + this.of_get_attribut(as_nom_objet,'id') + " tabsequence=" + this.of_get_attribut(as_nom_objet,'tabsequence') + " moveable=0 resizeable=0 pointer='" + this.of_get_attribut(as_nom_objet,'pointer') + "' band=Detail visible='" + this.of_get_attribut(as_nom_objet,'visible') + "'" + &
" x='" + this.of_get_attribut(as_nom_objet,'x') + "' y='" + this.of_get_attribut(as_nom_objet,'y') + "' bitmapname=" + this.of_get_attribut(as_nom_objet,'bitmapname') + " format='" + this.of_get_attribut(as_nom_objet,'format') + "' alignment='" + this.of_get_attribut(as_nom_objet,'alignment') + "' height.autosize=" + this.of_get_attribut(as_nom_objet,'height.autosize') + " border='" + this.of_get_attribut(as_nom_objet,'border') + "' color='" + this.of_get_attribut(as_nom_objet,'color') + "' height='" + this.of_get_attribut(as_nom_objet,'height') + "' width='" + this.of_get_attribut(as_nom_objet,'width') + "' name=" + this.of_get_attribut(as_nom_objet,'name') + " tag='" + this.of_get_attribut(as_nom_objet,'tag') + "' protect='" + this.of_get_attribut(as_nom_objet,'protect') + "'" + &
" background.mode='" + this.of_get_attribut(as_nom_objet,'background.mode') + "' background.color='" + this.of_get_attribut(as_nom_objet,'background.color') + "' font.face='" + this.of_get_attribut(as_nom_objet,'font.face') + "' font.height='" + this.of_get_attribut(as_nom_objet,'font.height') + "' font.weight='" + this.of_get_attribut(as_nom_objet,'font.weight') + "' font.family='" + this.of_get_attribut(as_nom_objet,'font.family') + "' font.pitch='" + this.of_get_attribut(as_nom_objet,'font.pitch') + "' font.charset='" + this.of_get_attribut(as_nom_objet,'font.charset') + "' font.italic='" + this.of_get_attribut(as_nom_objet,'font.italic') + "' font.strikethrough='" + this.of_get_attribut(as_nom_objet,'font.strikethrough') + "' font.underline='" + this.of_get_attribut(as_nom_objet,'font.underline') + "' html.link='" + this.of_get_attribut(as_nom_objet,'html.link') + "' html.linktarget='" + this.of_get_attribut(as_nom_objet,'html.linktarget') + "'" + &
" edit.validatecode=" + this.of_get_attribut(as_nom_objet,'edit.validatecode') + " edit.focusrectangle=" + this.of_get_attribut(as_nom_objet,'edit.focusrectangle') + " edit.nilisnull=" + this.of_get_attribut(as_nom_objet,'edit.nilisnull') + " edit.password=" + this.of_get_attribut(as_nom_objet,'edit.password') + " edit.required=" + this.of_get_attribut(as_nom_objet,'edit.required') + " edit.hscrollbar=" + this.of_get_attribut(as_nom_objet,'edit.hscrollbar') + " edit.limit=" + this.of_get_attribut(as_nom_objet,'edit.limit') + " edit.codetable=" + this.of_get_attribut(as_nom_objet,'edit.codetable') + " edit.displayonly=" + this.of_get_attribut(as_nom_objet,'edit.displayonly') + " edit.autovscroll=" + this.of_get_attribut(as_nom_objet,'edit.autovscroll') + " edit.case=" + this.of_get_attribut(as_nom_objet,'edit.case') + " edit.autohscroll=" + this.of_get_attribut(as_nom_objet,'edit.autohscroll') + " edit.autoselect=" + this.of_get_attribut(as_nom_objet,'edit.autoselect') + " edit.vscrollbar=" + this.of_get_attribut(as_nom_objet,'edit.vscrollbar') + " edit.name='" + this.of_get_attribut(as_nom_objet,'edit.name') + "') "
//" x='" + this.of_get_attribut(as_nom_objet,'x') + "' y='" + this.of_get_attribut(as_nom_objet,'y') + "' bitmapname=" + this.of_get_attribut(as_nom_objet,'bitmapname') + " criteria.dialog=" + this.of_get_attribut(as_nom_objet,'criteria.dialog') + " criteria.override_edit=" + this.of_get_attribut(as_nom_objet,'criteria.override_edit') + " format='" + this.of_get_attribut(as_nom_objet,'format') + "' alignment='" + this.of_get_attribut(as_nom_objet,'alignment') + "' criteria.required=" + this.of_get_attribut(as_nom_objet,'criteria.required') + " height.autosize=" + this.of_get_attribut(as_nom_objet,'height.autosize') + " border='" + this.of_get_attribut(as_nom_objet,'border') + "' color='" + this.of_get_attribut(as_nom_objet,'color') + "' height='" + this.of_get_attribut(as_nom_objet,'height') + "' width='" + this.of_get_attribut(as_nom_objet,'width') + "' name=" + this.of_get_attribut(as_nom_objet,'name') + " tag='" + this.of_get_attribut(as_nom_objet,'tag') + "'" + &
//" edit.validatecode=" + this.of_get_attribut(as_nom_objet,'edit.validatecode') + " edit.focusrectangle=" + this.of_get_attribut(as_nom_objet,'edit.focusrectangle') + " edit.format=" + this.of_get_attribut(as_nom_objet,'edit.format') + " edit.nilisnull=" + this.of_get_attribut(as_nom_objet,'edit.nilisnull') + " edit.password=" + this.of_get_attribut(as_nom_objet,'edit.password') + " edit.required=" + this.of_get_attribut(as_nom_objet,'edit.required') + " edit.hscrollbar=" + this.of_get_attribut(as_nom_objet,'edit.hscrollbar') + " edit.limit=" + this.of_get_attribut(as_nom_objet,'edit.limit') + " edit.codetable=" + this.of_get_attribut(as_nom_objet,'edit.codetable') + " edit.displayonly=" + this.of_get_attribut(as_nom_objet,'edit.displayonly') + " edit.autovscroll=" + this.of_get_attribut(as_nom_objet,'edit.autovscroll') + " edit.case=" + this.of_get_attribut(as_nom_objet,'edit.case') + " edit.autohscroll=" + this.of_get_attribut(as_nom_objet,'edit.autohscroll') + " edit.autoselect=" + this.of_get_attribut(as_nom_objet,'edit.autoselect') + " edit.vscrollbar=" + this.of_get_attribut(as_nom_objet,'edit.vscrollbar') + " edit.name='" + this.of_get_attribut(as_nom_objet,'edit.name') + "') "
end choose
case 'ellipse'
ls_ret = &
"create ellipse(band=Detail" + &
" moveable=0 resizeable=0 x='" + this.of_get_attribut(as_nom_objet,'x') + "' y='" + this.of_get_attribut(as_nom_objet,'y') + "' height='" + this.of_get_attribut(as_nom_objet,'height') + "' width='" + this.of_get_attribut(as_nom_objet,'width') + "' name=" + this.of_get_attribut(as_nom_objet,'name') + " visible='" + this.of_get_attribut(as_nom_objet,'visible') + "'" + &
" tag='" + this.of_get_attribut(as_nom_objet,'tag') + "' brush.hatch='" + this.of_get_attribut(as_nom_objet,'brush.hatch') + "'" + &
" brush.color='" + this.of_get_attribut(as_nom_objet,'brush.color') + "' pen.style='" + this.of_get_attribut(as_nom_objet,'pen.style') + "' pen.width='" + this.of_get_attribut(as_nom_objet,'pen.width') + "' pen.color='" + this.of_get_attribut(as_nom_objet,'pen.color') + "' background.mode='" + this.of_get_attribut(as_nom_objet,'background.mode') + "' background.color='" + this.of_get_attribut(as_nom_objet,'background.color') + "')"
end choose
end if
2 - Let's go with this code straight out of the Datawindow Syntax tool from the PB IDE
For my dynamic creation I had to remove the criteria. properties because it made the create failed. I wanted to know if there's some properties, even if correctly set (or I assume because the values came from a dw.describe) that will make the create fail.
Now is it the Datawindow Syntax Tool returning incorrect informations or is it a create bug or maybe just me doing something wrong ?
" I wanted to know if there's some properties, even if correctly set (or I assume because the values came from a dw.describe) that will make the create fail."
Yes, absolutely! There are lots of attributes which are only available to certain dw objects and edit styles. Editmasks has different attributes, spin controls, etc. You only have to use an attribute in your Modify() string, if you create a column which has the corresponding edit style.
For example, the "criteria" property will be available only if you column has a dropdowndatawindow edit style, but not when it's a normal "edit". The nilisnull is also not always available (correct me if I'm wrong, I think it's not available for checkbox edit style).
So you cannot simply apply all possible attributes at the same time to a single column. First you have to decide what you want to create. The way to do that is easiest if you just create a datawindow with a single column which represents what you want to do, save it and then edit the source code or export it and open the exported file with an editor. That's the string you should use in the modify. (remember: to be able to create a column on a datawindow it has to be present in the "column=..." section. Also if the column is already visible on the datawindow, you cannot create it with the same name).
Regards,
MiguelL.