NetTalk Central

Author Topic: 2 color questions  (Read 2817 times)

RichBowman

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • Email
2 color questions
« on: December 20, 2011, 02:12:03 PM »
1. I have the Greenbar Effect checked on the Options tab in my Browse but it is not working. Is there a problem with this option or have I likely missed something?

2. How do I change the background color of a field based on the value of a another field in the file?

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: 2 color questions
« Reply #1 on: December 20, 2011, 04:19:16 PM »
In NT 5, greenbar colors are controlled from template entries CSS Classes tab on the browse. Colors box.
In NT 6, they are in the nettalk-ui.css file. Look for gb1 and gb2.

As far as recoloring things, you could make the style a variable that holds the class selector then change it as needed in the client side embed. Just include the field in the reset list.

HTH
chris


Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: 2 color questions
« Reply #2 on: December 20, 2011, 10:16:36 PM »
In addition to what Chris says;

>> 1. I have the Greenbar Effect checked on the Options tab in my Browse but it is not working. Is there a problem with this option or have I likely missed something?

The default greenbarring is very subtle, so I've noticed on some monitors (where the brightness / contrast isn't set very well) it's almost impossible to distinguish. You can change the colors (globally) if you like, or play a bit with your monitor settings to see if you're just not seeing it.

>> 2. How do I change the background color of a field based on the value of a another field in the file?

using css classes.
a) if you want to reset field B when field A changes then add field B to field A's "reset" list.
b) set the css of field B to be a variable or expression. For example;
Choose(p_web.gsv('A')=1,'red-bg','green-bg')

there are a number of pre-defined background styles for you to use;
.black-bg{background-color: #000000!important;}
.maroon-bg{background-color: #800000!important;}
.green-bg{background-color: #008000!important;}
.olive-bg{background-color: #808000!important;}
.orange-bg{background-color: #FF8000!important;}
.navy-bg{background-color: #000080!important;}
.purple-bg{background-color: #800080!important;}
.teal-bg{background-color: #008080!important;}
.gray-bg{background-color: #080808!important;}
.silver-bg{background-color: #0C0C0C!important;}
.red-bg{background-color: #FF0000!important;}
.lime-bg{background-color: #00FF00!important;}
.yellow-bg{background-color: #FFFF00!important;}
.blue-bg{background-color: #0000FF!important;}
.fuchsia-bg{background-color: #FF00FF!important;}
.aqua-bg{background-color: #00FFFF!important;}
.white-bg{background-color: #FFFFFF!important;}

however it's trivial of course for you to create your own, with any color you like.

cheers
Bruce

RichBowman

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • Email
Re: 2 color questions
« Reply #3 on: December 21, 2011, 01:25:21 PM »
For the Greenbar effect I followed Chris' suggestion, but I couldn't get it to work. Here's what I did:
1. Copied nettalk-ui-css to Bennett.css and put it in the Redmond themes directory and changed the gb2 color
2. In the Webserver procedure / Nettalk Extension / Settings / Styles / Files I added Bennett.css to both the Themes and CSS Styles sections
3. I recompiled the app to re-create the Gzipall.bat
4. I ran Gzipall.bat
5. Then my app but with no change in the greenbar colors

What step am I missing?

I tried to use Bruce's suggestion but I couldn't find anywhere in the Browse procedure where I can tell it to reset Field A when Field B changes. Also, the field that determines the background color is not in the Browse. It a code field and I don't want the user to see it.

Now for the weird part. I'm using the login form from the wizard with a few changes to validate the username and password. Once or twice a day I suddenly can't login. I've made no changes to the login form for days. I've tried deleting everything but the .app and re-generating the app but still can't login. I have a saved copy of the app so I import the login form from the backup copy and everything is fine - for another few hours until it happens again.

I'm really puzzled.

Any ideas would be most welcome.

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: 2 color questions
« Reply #4 on: December 21, 2011, 02:08:50 PM »
That all sounds right. Just a couple things to remember - css is case sensitive. Are you using the redmond theme in your app? I think the default is ui-lightnes (not sure).
Do you have the firebug plugin for Fire fox? You can see if your styles are getting reset by using it. You can see the over-ridden styles will have a line through them.
You don't need to use Gzip all to include your css file just include it in the file list. Also, unless you actually add it to the all.css file, make sure the "Is Included in ALL.CSS" box is unchecked.

As far as changing one field when another changes...
In the 'trigger' field, on the client side tab, check "send new value to server" - click the Server Code button and add your code to set the css selector. Something like
Case triggervalue
  of '1'
     loc:css='green-bg'
  of '2'
    loc:css='red-bg'
end
 Add the the 'changed' field name to the reset list.

In the 'changed' field, on the CSS tab, put loc:css in as the EntryDiv Class or the Entry class.
That should do it.

Bruce may see something I missed here (he usually does <g>)

HTH
Chris
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: 2 color questions
« Reply #5 on: December 21, 2011, 11:36:07 PM »
Rich,

Editing nettalk-ui.css is a bad idea. Don't do it.
rather add the changes, in a class with the same name, in your custom.css file.

Also I recommend watching the CSS webinar I did on ClarionLive to refresh your Css skills. Debugging Css is trivial - and the webinar shows how. Not knowing how to debug, or edit the css obviously just results in endless frustration. So _watch the webinar_ !

cheers
Bruce