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
579
Button in UltraWinGrid
posted

Hi,

In my UltraGrid ther's a count field (datasource of grid is dataview = SQL statement).

I've set the ColumnStyle to button

and the ButtonAppearStyle to Always.

Now when the field = 0 I don't want any button and no image.

When its higher then 0 I would like a button with an image and the text that is the number counted.

In this example the 0 should appear as any other field. (eg 'BE', '10000'...)

Also how can I set the image & text relationship? I'd like the image to be centered as the text.

Thank you for your time!

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    I recommend using the InitializeRow event. You can examine the value of the Instructions cell. If it is 0, you can set the Hidden property on the cell to hide the cell. Or, you could set the Style of the cell to something other that button - depending on what you want to display there.

    For the image, centering the image is very easy. There are properties on the Appearance object for ImageHAlign and ImageVAlign and Image. But there's no easy way to remove the text from the button.

    So if you want a button with no text, what I would do is use the InitializeLayout event of the grid and hide the real Instructions column. Then you add an Unbound column to the grid in it's place. Then you can based the Style and Appearance of the cells in the unbound button column on the hidden value of the real, bound column and it won't show any text, since the unbound column values will all be null.

Reply Children