Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently September 30th, 2024, 11:28 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Changing text box background color
PostPosted: August 11th, 2005, 4:32 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi

I've set up 2 buttons to allow viewers to change the background color of a text box (from white-255,255,255 to gray-213,213,213 or blue-192,218,192) for better visual contrast. With previous help, I've been able to add script to a reset button so that when the viewer returns to the page, they can reset their chosen background color along with all of the drag and drop items they've previously placed in the box.

The script to reset follows (from an earlier forum item's help):
var change_colour = ReadRegistryKey("HKEY_CURRENT_USER\\Software\\xyz","colour")
var new_style = new Object()
new_style.style = "solid"
new_style.colour = change_colour
TextX.SetBackground(new_style)

The problem arises when a viewer, having not set a new background color (leaving the white background as default), clicks the reset button.
With no value saved in the variable "colour," it resets/defaults the background color to black (no RGB color value).

Adding an if colour>0 {.....} to the script, simply disables the script entirely, so that it won't reset a color that has been chosen. It also doesn't solve the no-color-set-producing-a-black-text-box issue.

Any ideas?

Kind Regards,

Stephen


Top
 Profile  
 
 Post subject: Re: Changing text box background color
PostPosted: August 11th, 2005, 4:50 pm 
Offline
User avatar

Joined: October 25th, 2004, 10:33 am
Posts: 257
Location: UK
Opus: Pro 8
OS: Windows 7 Professional x64
System: Dell XPS15 i7x4 2.1Ghz 6GB 128GB SSD
This might work...

Code:
var change_colour = ReadRegistryKey("HKEY_CURRENT_USER\\Software\\xyz","colour")
if(change_colour!=""){
     var new_style = new Object()
     new_style.style = "solid"
     new_style.colour = change_colour
     TextX.SetBackground(new_style)
}


Top
 Profile Visit website  
 
 Post subject: Changing text box background color
PostPosted: August 11th, 2005, 4:55 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Thanks, Dave

This seems to work.

Kind Regards,
Stephen


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group