Very Hot Topic (More than 25 Replies) Coloring menu tree items (Read 3197 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Coloring menu tree items
Sep 5th, 2007 at 1:16pm
Print Post Print Post  
Is it possible to set the colors of the text on the Command tree?  I'd like to visually distinguish between the list of databases under the Add Data branch (Green) and the Search/Update branch (Blue)

Is it possible to remove the application's "New" "Open" and "Save" buttons if the user is not an Admin?
« Last Edit: Sep 7th, 2007 at 2:14pm by Hammer »  

**
Captain Infinity
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Some design questions.
Reply #1 - Sep 5th, 2007 at 2:30pm
Print Post Print Post  
In the Application Programming use RelabelTreeItem (was in Version 1.x)

/*
RelabelTreeItem can use the browser formatting codes:
  @. Print rest of line, don't look for more '@' signs
  @@ Print rest of line starting with '@'
  @l Use a large (24 point) font
  @m Use a medium large (18 point) font
  @s Use a small (11 point) font
  @b Use a bold font (adds FL_BOLD to font)
  @i Use an italic font (adds FL_ITALIC to font)
  @f or @t Use a fixed-pitch font (sets font to FL_COURIER)
  @c Center the line horizontally
  @r Right-justify the text
  @B0, @B1, ... @B255 Fill the backgound with fl_color(n)      
  @C0, @C1, ... @C255 Use fl_color(n) to draw the text
  @F0, @F1, ... Use fl_font(n) to draw the text
  @S1, @S2, ... Use point size n to draw the text
  @u or @_ Underline the text.
  @- draw an engraved line through the middle.
*/

Here is an example:
var n as Int

//  If @Group <> "Supervisors" Then {     //Commented out for now
If @userID <> "bob" Then {
     n = @RelabelTreeItem(@Application + "!Forms!Search/Update","")
     n = @RelabelTreeItem(@Application + "!Forms!Search/Update!Members","")
     n = @HideTreeItem(@Application + "!Forms!Search/Update!Members!Payments")
     n = @HideTreeItem(@Application + "!Forms!Search/Update!Members!Payments")
     n = @RelabelTreeItem(@Application + "!Forms!Search/Update!tblRooms!frmRooms", "@mSearch Rooms")
     n = @RelabelTreeItem(@Application + "!Forms!Add Data!tblRooms!frmRooms", "@S20@C255@B0Add Rooms")   //white on black
     // n = @RelabelTreeItem(@Application + "!Forms!Add Data!tblRooms!frmRooms", "@S20@C0@B255Add Rooms")   //black on white
}
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Some design questions.
Reply #2 - Sep 6th, 2007 at 5:14pm
Print Post Print Post  
Hi Bob!

What is "FL_" (as in "FL_COLOR")

I see how you get black or white text with @C0 or @C255, but how do you get Green and Blue?
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Some design questions.
Reply #3 - Sep 6th, 2007 at 5:43pm
Print Post Print Post  
Infinity wrote on Sep 6th, 2007 at 5:14pm:
Hi Bob!

What is "FL_" (as in "FL_COLOR")

I see how you get black or white text with @C0 or @C255, but how do you get Green and Blue?


Scott,

This method is not really part of Sesame. It is a side effect of the underlying GUI toolkit  (FLTK) that we don't really support. The FLs refer to constants within that toolkit. You can't access them directly.

The color numbers are looking at an internal FLTK color table. You'd have to play with the numbers to see what's what.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Some design questions.
Reply #4 - Sep 6th, 2007 at 5:48pm
Print Post Print Post  
Ah, I see.  Actually, I don't but that's OK.  I played with some of the stuff Bob showed me and did manage to change some colors, but if it's not supported I'd probably better not mess with it.

Which brings me back to the original question: is there a way with Sesame to color the text of the command tree items?
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Some design questions.
Reply #5 - Sep 6th, 2007 at 6:06pm
Print Post Print Post  
Infinity wrote on Sep 6th, 2007 at 5:48pm:
Which brings me back to the original question: is there a way with Sesame to color the text of the command tree items?

Not an officially supported way.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Some design questions.
Reply #6 - Sep 6th, 2007 at 6:17pm
Print Post Print Post  
Infinity wrote on Sep 6th, 2007 at 6:12pm:
Thank you.  Can using the FLTK method of relabeling "break" anything?

Not that we know of, but we also don't test it. You will have to change any @SelectTreeItem and suchlike calls to use the altered value.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Some design questions.
Reply #7 - Sep 6th, 2007 at 6:21pm
Print Post Print Post  
Thank you Erika & Bob.
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2492
Joined: Aug 20th, 2003
Re: Some design questions.
Reply #8 - Sep 6th, 2007 at 6:47pm
Print Post Print Post  
Infinity wrote on Sep 5th, 2007 at 1:16pm:
Is it possible to remove the application's "New" "Open" and "Save" buttons if the user is not an Admin?


If you give the admin users a different INI file then yes you can. The following entries in the INI file will disable those three buttons.

DISABLE BUTTONBAR BUTTON: NEW
DISABLE BUTTONBAR BUTTON: OPEN
DISABLE BUTTONBAR BUTTON: SAVE

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2492
Joined: Aug 20th, 2003
Re: Some design questions.
Reply #9 - Sep 6th, 2007 at 7:03pm
Print Post Print Post  
Infinity wrote on Sep 6th, 2007 at 5:14pm:
Hi Bob!

What is "FL_" (as in "FL_COLOR")

I see how you get black or white text with @C0 or @C255, but how do you get Green and Blue?


Not that I'm supporting this or encouraging it, but @C32256 will give you Blue and @C8257536 will give you Green. If you are trying to get a different shade don't just start changing the numbers around, as you probably won't get the results you want. Those numbers came from the following piece of code

Code
Select All
Color = @BShiftLeft(R, 24) + @BShiftLeft(G, 16) + @BShiftLeft(B, 8) 



Where R, G, and B are the Red, Green, and Blue values you want the color to have. Note. R, G, and B must be 255 or less.

32256 = R:0 G:0 B:126 or THIS COLOR
8257536 = R:0 G:126 B:0 or THIS COLOR

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Some design questions.
Reply #10 - Sep 6th, 2007 at 8:59pm
Print Post Print Post  
If you use the Sesame Custom Color picker in the Designer, I believe the values shown can be used to get the colors you want.  This is probably based on the FLTK color chooser tool.

Scott - I have sent you an off-line email with more information. Since this is not Sesame supported, I don't want to add any more confusion.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2492
Joined: Aug 20th, 2003
Re: Some design questions.
Reply #11 - Sep 6th, 2007 at 9:17pm
Print Post Print Post  
Bob_Hansen wrote on Sep 6th, 2007 at 8:59pm:
If you use the Sesame Custom Color picker in the Designer, I believe the values shown can be used to get the colors you want. 


You can use any number of programs to get the RGB values for the color that you want, such as MS Paint or any number of image editing tools. The trick is the shifting of the bits to get the correct color that you want as the last 8 bits, of the 32 bit number, must be 0's as that tells it to create a color using the first 24 bits.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Some design questions.
Reply #12 - Sep 7th, 2007 at 10:39am
Print Post Print Post  
Quote:
The following entries in the INI file will disable those three buttons.

DISABLE BUTTONBAR BUTTON: NEW
DISABLE BUTTONBAR BUTTON: OPEN
DISABLE BUTTONBAR BUTTON: SAVE 


Faaaantastic.  I'll need to add this one to my list of .ini entries.

And thanks for the advice on the color settings, I'll experiment with them today.


  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Some design questions.
Reply #13 - Sep 7th, 2007 at 11:00am
Print Post Print Post  
Quote:
The following entries in the INI file will disable those three buttons.

DISABLE BUTTONBAR BUTTON: NEW
DISABLE BUTTONBAR BUTTON: OPEN
DISABLE BUTTONBAR BUTTON: SAVE

This is successfully graying the New and Open buttons, but Save is still operational.
  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Some design questions.
Reply #14 - Sep 7th, 2007 at 11:06am
Print Post Print Post  
Here's the result of my current experimentation with the topics discussed in this thread:
http://www.jamiara.com/colors1.jpg
The colored tree items look fantastic, WOO HOO!.  New and Open are grayed, but Save is still available.
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2492
Joined: Aug 20th, 2003
Re: Some design questions.
Reply #15 - Sep 7th, 2007 at 1:05pm
Print Post Print Post  
Hello Scott,

I've tried those entries on several computers and the Save bar is grayed out successfully. Could you send me your complete INI file so that I can see what you are seeing?

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Some design questions.
Reply #16 - Sep 7th, 2007 at 1:15pm
Print Post Print Post  
On it's way, thanks Ray.
  

**
Captain Infinity
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Some design questions.
Reply #17 - Sep 7th, 2007 at 1:29pm
Print Post Print Post  
Infinity wrote on Sep 7th, 2007 at 11:06am:
Here's the result of my current experimentation with the topics discussed in this thread:
http://www.jamiara.com/colors1.jpg


Bravo! Looks GREAT!
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Some design questions.
Reply #18 - Sep 7th, 2007 at 2:09pm
Print Post Print Post  
Good work Scott.

Can you provide some examples of how you used RelabelTreeItems to make that happen?
I did not provide a screen shot with my sample code.  Your samples with your image would be great.

How about changing topic from "Some design questions" to "Menu Tree Colors?" to make it easier to find on forum in the future?

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Some design questions.
Reply #19 - Sep 7th, 2007 at 2:14pm
Print Post Print Post  
Bob_Hansen wrote on Sep 7th, 2007 at 2:09pm:
How about changing topic from "Some design questions" to "Menu Tree Colors?" to make it easier to find on forum in the future?


Done.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Some design questions.
Reply #20 - Sep 7th, 2007 at 2:36pm
Print Post Print Post  
Quote:
Can you provide some examples of how you used RelabelTreeItems to make that happen?

While the thread discussion was going on, I did a Google search and found a copy of the FLTK color table, showing all 256 colors (http://fltk.org/documentation.php/doc-1.1/functions.html#fl_show_colormap).  I spotted a color I liked for Green (100) and Blue (176) by counting across and down the chart.  Those looked nice, but after Ray posted his numbers I decided I liked the Green with his number (8257536) better.

I then adapted the code that Erika taught me a few days ago to contract the command tree items, throwing the relabel commands into the loop.  As so:
Code
Select All
var vList as String
var vCount as Int
var vLoop as Int
var vApp as String
var vDB as String
var vTemp as Int
Var vColor as Int

// Contracts and colors the Command Tree mode items
vApp = @Application
vList = @ListDatabases()
vCount = @CountStringArray(vList)
For vLoop = 1 to vCount
	vDB = @AccessStringArray(vList, vLoop)
	vTemp = @ContractTreeItem(vApp + "!Forms!Add Data!" + vDB)
	vColor = @RelabelTreeItem(vApp + "!Forms!Add Data!" + vDB, "@C8257536" + vDB)
	vTemp = @ContractTreeItem(vApp + "!Forms!Search/Update!" + vDB)
	vColor = @RelabelTreeItem(vApp + "!Forms!Search/Update!" + vDB, "@C176" + vDB)
Next
vTemp = @ContractTreeItem(vApp + "!Forms!Add Data!")
vTemp = @ContractTreeItem(vApp + "!Forms!Search/Update!") 

  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Coloring menu tree items
Reply #21 - Sep 7th, 2007 at 2:52pm
Print Post Print Post  
This page: http://fltk.org/documentation.php/doc-1.1/functions.html#fl_show_colormap shows the FLTK color map (bottom of page).  There are 8 colors across and 32 down, for a total of 256 (black is zero).  Find a color you like, count across and down, do a bit of math and you have the number of the color for the @C attribute.
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2492
Joined: Aug 20th, 2003
Re: Coloring menu tree items
Reply #22 - Sep 7th, 2007 at 3:05pm
Print Post Print Post  
Hello Scott,

I may be wrong about this, and I'm sure Mark or Erika will chime in if I am, but I believe that we change the color table, so 176 in a different Sesame Application may not always be the blue that it is on your system.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Coloring menu tree items
Reply #23 - Sep 7th, 2007 at 3:10pm
Print Post Print Post  
Quote:
Hello Scott,

I may be wrong about this, and I'm sure Mark or Erika will chime in if I am, but I believe that we change the color table, so 176 in a different Sesame Application may not always be the blue that it is on your system.


We do indeed. We don't mess much with the colors below 256, but there are exceptions.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Coloring menu tree items
Reply #24 - Sep 7th, 2007 at 3:26pm
Print Post Print Post  
OK, good to know, I'll use the number Ray gave me for Blue.  Thanks.
  

**
Captain Infinity
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Some design questions.
Reply #25 - Sep 8th, 2007 at 3:47pm
Print Post Print Post  
Quote:
Hello Scott,

I've tried those entries on several computers and the Save bar is grayed out successfully. Could you send me your complete INI file so that I can see what you are seeing?

-Ray

It's grayed out until you open an applicaton.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2492
Joined: Aug 20th, 2003
Re: Some design questions.
Reply #26 - Sep 10th, 2007 at 4:22pm
Print Post Print Post  
Quote:
It's grayed out until you open an applicaton.


Yup Scott figured that out and I'm looking at the source of Sesame to get it fixed.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged