quark122
asked on
Setting column heading information
I'm creating a grid datawindow dynamically with the dw.create function.
ll_rtn = dw_1.create(ls_syntax, ls_error)
Now I want to go through the columns and for each column heading, make it raised with a button face color. I know each column name because I dynamically built the syntax, so I can loop through the select columns. I tried going through those columns and doing (ls_temp has the specific column name)
dw_1.SetBorderStyle(ls_tem p, Raised!)
ls_modify = ls_temp + ".Background.Color = " + is_buttonface_color
ls_rtn = dw_1.Modify(ls_modify)
but that set for the entire column. I also tried:
dw_1.SetBorderStyle(ls_tem p + "_t", Raised!)
ls_modify = ls_temp + "_t.Background.Color = " + is_buttonface_color
ls_rtn = dw_1.Modify(ls_modify)
And PB complained about invalid column.
I just need the top line where it has the column names to be set to buttonface & raised. I need a better way of determining the button face as well. I pulled it from a default datawindow.
--Will
ll_rtn = dw_1.create(ls_syntax, ls_error)
Now I want to go through the columns and for each column heading, make it raised with a button face color. I know each column name because I dynamically built the syntax, so I can loop through the select columns. I tried going through those columns and doing (ls_temp has the specific column name)
dw_1.SetBorderStyle(ls_tem
ls_modify = ls_temp + ".Background.Color = " + is_buttonface_color
ls_rtn = dw_1.Modify(ls_modify)
but that set for the entire column. I also tried:
dw_1.SetBorderStyle(ls_tem
ls_modify = ls_temp + "_t.Background.Color = " + is_buttonface_color
ls_rtn = dw_1.Modify(ls_modify)
And PB complained about invalid column.
I just need the top line where it has the column names to be set to buttonface & raised. I need a better way of determining the button face as well. I pulled it from a default datawindow.
--Will
Or you can loop through all objects in the header band, and set these properties:
get a list of all the objects :
ls_Objects = dw_control.Object.DataWind ow.Objects
This will give you list of objects in a tab seperated string. Seperate out the object names to an array say ls_ObjectList ( pfc_ncst_string has a method for this, you can copy from there if not using PFC) , and checbk the band :
For li_Counter =1 to li_ColCount
if( pos(dw_control.Describe(ls _ObjectLis t[li_count er]+".Band "), 'header')) then
ls_modify = ls_ObjectList[li_counter]+ ".Background.Color = " + is_buttonface_color
ls_rtn = dw_control.Modify(ls_modif y)
ls_modify = ls_ObjectList[li_counter] + ".Border = 6"
ls_rtn = dw_control.Modify(ls_modif y)
end if
Next
regards,
Vikas D.
get a list of all the objects :
ls_Objects = dw_control.Object.DataWind
This will give you list of objects in a tab seperated string. Seperate out the object names to an array say ls_ObjectList ( pfc_ncst_string has a method for this, you can copy from there if not using PFC) , and checbk the band :
For li_Counter =1 to li_ColCount
if( pos(dw_control.Describe(ls
ls_modify = ls_ObjectList[li_counter]+
ls_rtn = dw_control.Modify(ls_modif
ls_modify = ls_ObjectList[li_counter] + ".Border = 6"
ls_rtn = dw_control.Modify(ls_modif
end if
Next
regards,
Vikas D.
Little correction :
if( pos(dw_control.Describe(ls _ObjectLis t[li_count er]+".Band "), 'header') >0) then
vikas
if( pos(dw_control.Describe(ls
vikas
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Namasi, that's what I had been doing, but it wasn't working last night. I tweaked it a bit this AM and it's sort of working... (I don't get errors).
It still doesn't set the color to what I expect it to be though. In the Datawindow painter, I can set the color to "buttonface", how can I do that through code?
It still doesn't set the color to what I expect it to be though. In the Datawindow painter, I can set the color to "buttonface", how can I do that through code?
Once you create the datawindow using CREATE, obtain the syntax of datawindow using.
setting = dw_1.Object.DataWindow.Syn tax
OR
setting = dw_1.Describe("DataWindow. Syntax")
//You will find that the syntax is not exactly what you set it to.
mle_1.Text = setting <--- Copy this syntax and see how exactly the column headers are named.
It may be depeneds on the scenario we discussed above.
1) columnname + '_t' <-- select from single table
OR
2) tablename + '_' + columnname + '_t' if select from multiple table and the the length of "tablename + '_' + columnname + '_t' " is less tha 37 chars.
OR
3) empty if "tablename + '_' + columnname + '_t' " is greater than 37 chars.
Then verify if your code handles this scenario.
regards,
Namasi-
setting = dw_1.Object.DataWindow.Syn
OR
setting = dw_1.Describe("DataWindow.
//You will find that the syntax is not exactly what you set it to.
mle_1.Text = setting <--- Copy this syntax and see how exactly the column headers are named.
It may be depeneds on the scenario we discussed above.
1) columnname + '_t' <-- select from single table
OR
2) tablename + '_' + columnname + '_t' if select from multiple table and the the length of "tablename + '_' + columnname + '_t' " is less tha 37 chars.
OR
3) empty if "tablename + '_' + columnname + '_t' " is greater than 37 chars.
Then verify if your code handles this scenario.
regards,
Namasi-
Have you create the ls_syntax using the SyntaxfromSQL ? or manually prepared the syntax ?
You can check the actual names of the column headers by viewing them in debugger/messagebox. Usually it's the column name + '_t'. I guess there's some setting in the system options where you can change this. I f you are assembling the syntax, then you can modify these values there only.
li_ColCount = Integer(dw_1.Object.DataWi
For li_Counter =1 to li_ColCount
ls_ColName = dw_1.Describe("#"+String(l
ls_modify = ls_ColName + "_t.Background.Color = " + is_buttonface_color
ls_rtn = dw_1.Modify(ls_modify)
ls_modify = ls_ColName + "_t.Border = 6"
ls_rtn = dw_1.Modify(ls_modify)
Next
Regards,
Vikas