06-11-2009 08:35 AM
Hi
I have used the TABLE object in a SUD DIALOG in DiAdem 11 to display calculated values to the user. That works fine.
My boss has now asked me to set the color of cells containing values which are out of specification, to RED.
I don't think I can do this with the TABLE object, but I discovered the XTABLE object which seems to allow the properties of individual cells to be set.
In theory, this XTABLE object seems very useful, unfortunately, I have been unable to discover from the help file, how to set the values in the cells at run time. I can set a whole column of cells to the same value using the EventColCtrlPreSet(Col, ByRef Cell, IsInputCell) example, but how do I set each individual cell to a different value programatically?
Please can you help, as trial and error is getting me nowhere.
Thanks in advance
Phil
Solved! Go to Solution.
06-11-2009 09:10 AM
Hello Phil!
If you switch from TABLE to XTABLE you have to understand the complete different aproach for the same task in this two controls. If you use TABLE you have to fill it with content. XTABLE instead will ask you for every cell value in an event. You just have to set the row count in your code where you filled the TABLE. In the event 'EventValGet' you have to use the row/col numbers to adress your data. The XTABLE will only call the event for the cells visible. If you understand this you can have a look onthe example again to understand how it works.
BTW: XTABLE could be named as a 'Virtual Table'
Matthias
Matthias Alleweldt Project Engineer / Projektingenieur | Twigeater? |
06-11-2009 10:48 AM
Thanks very much Matthias
I have it working well now.
Phil
06-12-2009 09:24 AM
This is for any one else reading this post,
I thought you might like to see an example of the callback to fill the XTable:
Sub GroupXTable_EventValGet(Row, Col, ByRef Cell, IsInputCell)
Dim This : Set This = GroupXTable
If Col = 0 Then
If Row = 0 Then Cell.Text = ... ' top left cell
If Row > 0 Then Cell.Text = Row ' row headers
Elseif Row = 0 Then
Select Case Col
Case 1 : Cell.Text = ... ' column 1 header
Case 2 : Cell.Text = ... ' column 2 header
Case 3 : Cell.Text = ... ' column 3 header
Case 4 : Cell.Text = ... ' column 4 header
Case 5 : Cell.Text = ... ' column 5 header
Case 6 : Cell.Text = ... ' column 6 header
Case 7 : Cell.Text = ... ' column 7 header
End Select ' Col
Elseif Row <= UBound(Groups) Then
Select Case Col
Case 1 : Cell.Text = ... ' column 1 value
Case 2 : Cell.Text = ... ' column 2 value
Case 3 : Cell.Text = ... ' column 3 value
Case 4 : Cell.Text = ... ' column 4 value
Case 5 : Cell.Text = ... ' column 5 value
Case 6 : Cell.Text = ... ' column 6 value
Case 7 : Cell.Text = ... ' column 7 value
End Select ' Col
End If
End Sub
Bad Turpin
DIAdem Product Support Engineer
National Instruments
01-28-2019 12:06 PM
Phil (or Anyone else)
Can you show how you changed cell colors based on the value?
Thanks,
02-01-2019 07:07 AM
Hi!
You can access the color of a cell with the "BackColor" property.
Please see the article of the BackColor property for the EditBox cell type: http://zone.ni.com/reference/en-XX/help/370858P-01/sudref/properties/sud_property_backcolor_toeditct...
With a simple If..Then..Else or a Case statement (based on the values) you can control the flow and therefore the background color of a cell as well.