NetTalk Central

Author Topic: Color picker - Show Entry Field, Allowing Optional Colors, Gradient Display  (Read 6231 times)

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Hi,

I have got the color picker working close to what I need but I have encountered a bug (I think),  added a workaround to make color optional, and have a minor display issue.

The bug first.  Regardless of whether the Show Field Entry check box is turned on or off, the color entry field is always there.  It would be nice just to have the color picker button and the display example.

For my application color is optional for the entity, but when using STRINGS as the color type the color field always defaults to #000000 (black) on saving the record.   I got around this problem by overriding the ColorWeb method with this code before the Parent call:
 
IF  Clip(P_color) =''         
  ReturnValue = ''             
  RETURN(ReturnValue)
END

Easy to do, but it took a while to track down so it might be better in the base class.

Finally, the Live Update is great for displaying the users color choice, but the updated display field shows the background color as a gradient until the record is saved.  After the record is saved, the color shows as the desired solid.  The trouble with the initial gradient display is that makes the color choice look lighter than it actually is.

Minor issues to be sure, but worth considering for a future update.  I have attached a modified app and dct for the Basic Browse and Form example (web1) that demonstrate the issues.

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
>> Finally, the Live Update is great for displaying the users color choice, but the updated display field shows the background color as a gradient until the record is saved.  After the record is saved, the color shows as the desired solid.  The trouble with the initial gradient display is that makes the color choice look lighter than it actually is.

So this is somewhat cunning. If you check out the CSS for the display field (the one being updated) you'll see

'ui-corner-all colorpicker_example nt-grad'

the key here is nt-grad. nt-grad is what makes colors "shade". So if you're gonna uses the colors shaded, then leave it in, if not, remove it.
If you look at the BrowseRooms in the Hotdates example, you'll see nt-grad used there as well.

>> The bug first.  Regardless of whether the Show Field Entry check box is turned on or off, the color entry field is always there.

fixed in 6.22

cheers
Bruce



CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Thanks, Bruce

Spent a while going over the example output in Firebug.  Inspecting the CSS for the element didn't show any style sheet with "nt-grad".   I searched through all the CSS files in the Web folder and couldn't find such a string.

The element has the HTML below when the color picker has been engaged.

<input type="text" autocomplete="off" style="background: -moz-linear-gradient(center bottom , rgb(255, 255, 255) 0%, rgb(230, 135, 157) 75%) repeat scroll 0% 0% transparent;" readonly="readonly" class="nt-entry nt-entry-readonly" value="" id="ColorSample" name="ColorSample">

What am I missing?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Hi Casey,

ahh - well - this is one of those cases where a little cunningness is involved. For various boring technical reasons (not least, that the browsers do grading differently), nt-grad is a "dynamic class" - meaning that it isn't done with CSS but with JavaScript.

elements marked with nt-grad are detected by the gradient function (see netwenb.js) and the "current solid color" is changed to a gradient. This approach has the added benefit of working with "all colors" so simplifies the "generated css" (which is generated when the colors come from a data file.)

Look at the css settings in the template for the field, and you should see the nt-grad class specified there.

cheers
Bruce

jari@softmade.fi

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • Email
Hi Bruce

I have same problem, so can you give me more information what I should do.

Jari

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
What problem are you having Jari?

jari@softmade.fi

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • Email
This one:

Finally, the Live Update is great for displaying the users color choice, but the updated display field shows the background color as a gradient until the record is saved.  After the record is saved, the color shows as the desired solid.  The trouble with the initial gradient display is that makes the color choice look lighter than it actually is.