Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
535
Couple of Easy Questions
posted

These should be fairly easy questions:

1.  I would like to draw a blue border around any cell that's been changed since the last update...what's the best way to do this?

2.  I would like to change the forground color of the text in a cell if the first character is a ! - for example to indicate a phone number is disconnected !(123) 456-7890 would display in red

3. I have a fairly simple table with one column being a "status" this is an integer that relates to a status table (1=Active, 2=Inactive, 3=Dead).  I'd like that column to be a combobox bound to column 1 of the status table, but displaying column 2.

4. Do I need to manually call a save function for the grid?  I assume so, does it have a way I can determine if data is changed (ie OnClose() ...if ultrgrid1.DataIsDirty()  then save...

Thanks for your help on this.  This is my first adventure with ultragrid (having come from years and years of doinng stuff myself with ado in C++)

Peter

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi Peter,

    howudodat said:
    1.  I would like to draw a blue border around any cell that's been changed since the last update...what's the best way to do this?

    Drawing a border around a cell is not easy. Most cells in the grid only draw one or two sides of their own borders. If every cell drew all 4 sides, there would be double-thick borders between each cell. So each cell only draws one or 2 and relies on the adjacent cells to draw their own borders to present a nicer look.

    If you want to draw a border around a cell, then you could have to do this using a DrawFilter so that you could draw all 4 sides.

    I recommend using some other indicator - like maybe the BackColor of the cell, or maybe make the font bold. That would be a lot easier and you could do it using the cell's Appearance.

    howudodat said:
    2.  I would like to change the forground color of the text in a cell if the first character is a ! - for example to indicate a phone number is disconnected !(123) 456-7890 would display in red

    You could do this using the InitializeRow event. There are samples of this sort of thing all over the place - like in the documentation and in the Samples Explorer. If you are concerned about doing this in the most efficient way, you should check out the WinGrid Performance Guide.

    howudodat said:
    3. I have a fairly simple table with one column being a "status" this is an integer that relates to a status table (1=Active, 2=Inactive, 3=Dead).  I'd like that column to be a combobox bound to column 1 of the status table, but displaying column 2.

    HOWTO:What is the best way to place a DropDown list in a grid cell?

    howudodat said:
    4. Do I need to manually call a save function for the grid?  I assume so, does it have a way I can determine if data is changed (ie OnClose() ...if ultrgrid1.DataIsDirty()  then save...

    The grid only saves the data to it's DataSource. You might have to call the grid.UpdateData method to make sure the data is committed from the grid to the data source. If you are talking about updating the data from your data source to the back end (database), then the grid is not involved in that process at all. How you do that depends on your data source, and you should consult Microsoft's documentation.

Reply Children