Jump to content

show colored bullet in dbgrid [SOLVED]


mierlp

Recommended Posts

hi

I have a table called 'Status' with the following rows:

- StatusID (autoinc)
- Name (var)
- Color (var)

The user has to select a color for a certain status. Let say the follow status :

- In progress = yellow
- Done = green

The selected color is saved in the field 'Color' and contains the color colde like '$0000B9FF'

Now i would like to show in a DBgrid, see attachment:

- the name
- a big dot with the
corresponding color from the field 'Color'

How can i do this ?

 

 

 

dgrid with bullet.jpg

Link to comment
Share on other sites

Hi Sherzod

Thank you for the examples but I prefer not to work with images. You should also always include this with the installation
and you have to make translation for the selected color and which image it it.

Is there no other way. I am thinking, for example, of the use of ALT codes.
Every new record receives this ALT code, which then has a standard white color.
In the dbgrid the font size and color are adjusted to the value in the 'Color' field

But no idea if that's possible and i solution

Or is there a solution to based on a separate table which contains colored images / color code
from the bullets and showing them in a dblookupcombobox...which is not possible i think?

Regards Peter

Link to comment
Share on other sites

Hi

I found a solution...what did i do :

  •  the field color contains the correct color for the bullet
  •  i created a calculated field called 'bullet'
  •  in the onCalcFields i added this code : dmStatus.StatusBooking.FieldByName('Bullet').value := '=';
  •  i added the field 'bullet' as a extra column to the uniDBgrid
  •  change the font.name for this column to 'webdings'        <== important because now you got a nice big bullet
  • change the font.size for this column to 20                           <== then you got a nice big button
  •  uniDBgrid.OnDrawColumnCell i added this code
    • if ACol=1 then begin
        Attribs.Font.Color  := uniDBgrid.Datasource.Dataset.FieldByName('Color').value;
      end;

 

ApplicationFrameHost_fWLZsP4UiT.png

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...