MSFN Forum: Enhancement: checked item label styling and forced install display - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Enhancement: checked item label styling and forced install display Rate Topic: -----

#1 User is offline   zorphnog 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 427
  • Joined: 25-July 06

Posted 03 August 2006 - 12:00 PM

I began working on an enhancement for displaying the forced installs as always checked, per this post. Since then I have cleaned up the code so that forced installs now show up as a checked and disabled checkbox. While I was doing this I also wanted to have a way to highlight the labels of the programs that were checked (for readability purposes). So I made some changes to check.js, boxes.js, and the wpi.css of my theme. I thought some of you might be interested so here is everything.

Screenshots
Default programs:
Posted Image
All programs:
Posted Image
None programs (with forced programs still checked)
Posted Image

Files
...and here are the changed files (based off the original 5.2 files):
[attachment=13633:attachment][attachment=13634:attachment][attachment=13635:attachment]P.S. - The css file is for the Glossy theme.

Code
And the code changes for those interested are as follows:
1. Modify boxes.js starting at line 131 as follows:
//insert checkbox and label
// -- checkbox --  
if (DebugOn) 
	txt += '<font class="txt">' + i + '</font>\n';
txt += '<input type="checkbox" id="chkbox' + i + '"';
if (uid[i]==null || uid[i]=="")
{
	txt += 'name="chkbox' + i + '" ';
	txt += 'onclick="checkDeps(' + i + '); checkCategory(' + i + ');"';
}
else 
{
	txt += 'name="' + uid[i] + '" ';
	txt += 'onclick="checkDeps(' + i + '); checkCategory(' + i + ');"';
}
txt += 'onMouseOver="qdh(prog[' + i + '],desc[' + i + '],Style[0]);" ';
txt += 'onMouseOut="htm();"';
if (forc[i]!=null && forc[i]=='yes')				 //Added code
	txt += ' checked';							   //Added code
if (DoGray || (forc[i]!=null && forc[i]=='yes'))	 //Modified code
	txt += ' disabled';
txt += (' />\n');
// -- label --

if (DoGray) 
	txt += '<label class="gtxt" id="lbl' + i + '" ';
else if (forc[i]!=null && forc[i]=='yes')				 //Added code
	txt += '<label class="chktxt" id="lbl' + i + '" ';	//Added code
else
	txt += '<label class="txt" id="lbl' + i + '" ';


2. check.js:
A. Modify the setChecked function as follows:
else 
{
	var chkbox = document.getElementById("chkbox"+i);	 //Modified code
	var lbl = document.getElementById('lbl'+i);		   //Added code

	if (chkbox==null) 
		return;
	if (chkbox.disabled) 
		return;
	if (!chkbox.checked) 
		debug("setChecked  for '" + prog[i] + "' (uid=" +uid[i] + ")",1,4);
	chkbox.checked=true;		//Modified code
	lbl.className='chktxt';	 //Added code
	tabs++;
	checkParent(i);
	if (DisableOnDepsNotMet) 
		enableChildren(i); 
	if (useExclusions) 
		checkExclusions(i);
	tabs--;
}

B. Modify the setUnchecked function as follows:
else 
{
	var chkbox = document.getElementById("chkbox"+i);	 //Modified code
	var lbl = document.getElementById('lbl'+i);		   //Added code
	if (chkbox==null) 
		return;
	chkbox.checked=false;	//Modified code
	lbl.className='txt';		//Added code
	debug("setUnchecked for '" + prog[i] + "' (uid=" +uid[i] + ")",1,4); 
	tabs++;
	uncheckChildren(i);
	if (DisableOnDepsNotMet) 
		disableChildren(i);
	if (useExclusions) 
		checkExclusions(i);
	tabs--;
}

C. Modify checkDeps as follows:
if (elem.disabled)
{
	if (forc[i]!=null && forc[i]=='yes')	 //Added code
		return;							  //Added code
	elem.checked=false; 
	return 0; 
}


3. wpi.css: In the wpi.css file of your favorite theme add the following class
.chktxt	//Added code style for highlighted (checked) Programs
{
	font-family: arial;
	font-weight: bold;
	color: #EBB313;
	font-size: 8pt;
	margin-left: 5px;
	margin-right: 10px;
}
...and style it however you would like.

This post has been edited by zorphnog: 04 August 2006 - 07:05 AM



#2 User is offline   Pliek 

  • Member
  • PipPip
  • Group: Members
  • Posts: 149
  • Joined: 07-February 06

Posted 03 August 2006 - 01:58 PM

Is this for WPI v5.2 , and wil this work also on v5.0.1?
Nice anyway :thumbup :thumbup

#3 User is offline   colornokia 

  • Newbie
  • Group: Members
  • Posts: 38
  • Joined: 30-July 04

Posted 03 August 2006 - 02:08 PM

Very nice solution I love it. It should be in the new version

#4 User is offline   zorphnog 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 427
  • Joined: 25-July 06

Posted 03 August 2006 - 02:09 PM

View PostPliek, on Aug 3 2006, 03:58 PM, said:

Is this for WPI v5.2 , and wil this work also on v5.0.1?


It is for WPI v5.2. I just started using WPI at v5.1, so I don't know if it will work with v5.0.1. There really aren't that many lines added/changed (like 14 lines and the chktxt css class). So you could try it with 5.0.1 if you want. I'll edit the posted code with //comments for added/changed tags so you can see which lines to change.

#5 User is offline   mritter 

  • WPI Co-Developer
  • Group: Developers
  • Posts: 1,088
  • Joined: 13-November 05

Posted 03 August 2006 - 08:00 PM

I added this in to 5.3 minus the color highlighting (for now). I like it.

#6 User is offline   Pliek 

  • Member
  • PipPip
  • Group: Members
  • Posts: 149
  • Joined: 07-February 06

Posted 03 August 2006 - 11:15 PM

View Postmritter, on Aug 4 2006, 03:00 AM, said:

I added this in to 5.3 minus the color highlighting (for now). I like it.

Verry nice, hopes it comes out soon... :thumbup

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy