NetTalk Central

Author Topic: Dropdown text colour  (Read 5153 times)

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Dropdown text colour
« on: June 13, 2013, 02:46:11 AM »
Hi Everyone,
     Please can anyone help? I have a drop down that display a list of names that is got from another table. All this works fine but now I want each of the names text in the dropdown to display the names in the colour assigned to the name in a configuration file that I have.

Thank you.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Dropdown text colour
« Reply #1 on: June 13, 2013, 07:23:14 AM »
This gets tricky. Doable, but hard to describe.
Maybe post a small example, with some sample data, and I'll see what I can do.

cheers
Bruce

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Dropdown text colour
« Reply #2 on: June 13, 2013, 11:53:10 PM »
Hi Bruce,
  I have attached an example app which I have modified the customer table to include colour for each customer from the customer form. Also attached to the index page is a button to call up a memory form which has the dropdown list of the customers but would like the customer names to be displayed with their colour settings from their file.

Thanks

[attachment deleted by admin]
« Last Edit: June 13, 2013, 11:57:23 PM by olu »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Dropdown text colour
« Reply #3 on: June 14, 2013, 01:10:15 AM »
You'll need build 7.12 to make this a bit easier.

In the DropListForm procedure, Value::MydropList routine, inside the loop, I set

loc:extra = 'style="color:' & clip(CUS:CustomerColour) & ';"'

(see attached pic).

Note that the color in your database is already in web format. If it was in Clarion format I would have used;

loc:extra = 'style="color:' & p_web.ColorWeb(CUS:CustomerColour) & ';"'

In some cases you might have a background color instead of a forground color;

loc:extra = 'style="background-color:' & clip(CUS:CustomerColour) & ';"'

and, if you are setting the background-color, and you want something a little bit more interesting, then set the CSS for the Drop field - set the "Drop Part" to 'nt-grad'

Cheers
Bruce



[attachment deleted by admin]

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Dropdown text colour
« Reply #4 on: June 14, 2013, 02:10:13 AM »
Hi Bruce,
     Thanks for the reply, but still can get it to work. I have added the code as you have suggested but nothing happens. I am using 7.10. Do I have to upgrade to make this work?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Dropdown text colour
« Reply #5 on: June 14, 2013, 02:36:38 AM »
yes, you need build 7.12

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Dropdown text colour
« Reply #6 on: June 14, 2013, 03:24:36 AM »
hi bruce,
   so where do i get 7.12 ? as it says on capesoft the build is 7.11

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Dropdown text colour
« Reply #7 on: June 14, 2013, 03:26:41 AM »
7.12 should be up in a little while - probably later today.


olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Dropdown text colour
« Reply #8 on: June 14, 2013, 03:47:00 AM »
Okay thanks bruce !

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Dropdown text colour
« Reply #9 on: June 18, 2013, 11:12:45 PM »
Hi Bruce,
    Just found out that this does not work in safari on macs. It works okay on ie and firefox.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Dropdown text colour
« Reply #10 on: June 20, 2013, 02:08:56 AM »
yes, I agree. I've tried on our Mac and it seems to ignore the style settings for the drop-down options. Firefox on Mac is ok, Safari on windows is Ok. But Safari on mac not so much.

this seems to be a Safari issue - I found other reports of it via Google, but no resolutions. I'll dig some more but this may just be one of those things that are what they are.

cheers
Bruce