Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Overriding icons
Tolstoy
Member

Posts: 13
Registered: 5/25/2006
Member Is Offline
posted on 5/25/2006 at 02:30 AM Reply With Quote
Overriding icons


Is there anyway to override all of the default icons without having to specify i0,i4,i8, et cetera in the items file? I want to have a special icon for one of my items that doesn't change... but the only way I could make it work was to specify it for every single icon state, which is rather cumbersome.

Example:

['MyWindow', 0, {'tt' : 'My tooltip', 'sb':'Use Firefox dude', 'i0' : 'icons/myicon.gif', 'i4' : 'icons/myicon.gif', 'i8' : 'icons/myicon.gif', 'i12' : 'icons/myicon.gif', 'i64' : 'icons/myicon.gif', 'i68' : 'icons/myicon.gif', 'i72' : 'icons/myicon.gif', 'i76' : 'icons/myicon.gif'},

I personally would prefer something like

['MyWindow', 0, {'tt' : 'My tooltip', 'sb':'Use Firefox dude', 'i99' : 'icons/myicon.gif'},

Would be much easier! All around great product!
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 5/25/2006 at 11:39 AM Reply With Quote

here is how we approach this issue in the SCMS:

1. here we describe the supported classes and icons for each of them.
Code:

var a_iconkeys = ['name',0,4,8,12,64,68,72,76],
a_classes = [null,
['project','cl1.gif','cl1.gif','cl1.gif','cl1.gif','cl1.gif','cl1.gif','cl1.gif','cl1.gif'],
['folder','cl2.gif','cl2.gif','folderopen.gif','folderopen.gif','folderopen.gif','folderopen.gif','folderopen.gif','folderopen.gif'],
['document','cl3.gif','cl3.gif','cl3.gif','cl3.gif','cl3.gif','cl3.gif','cl3.gif','cl3.gif'],
['template','cl4.gif','cl4.gif','cl4.gif','cl4.gif','cl4.gif','cl4.gif','cl4.gif','cl4.gif'],
['script','cl5.gif','cl5.gif','cl5.gif','cl5.gif','cl5.gif','cl5.gif','cl5.gif','cl5.gif'],
['variable','cl6.gif','cl6.gif','cl6.gif','cl6.gif','cl6.gif','cl6.gif','cl6.gif','cl6.gif']
];


2. this function merges item scope settings of particular item (in this case id) with the class information
Code:

function iss (class_id, item_id, selectable) {
var iss_data = [];
for (var i = 0; i < a_iconkeys.length; i++)
iss_data['i' + a_iconkeys] = ip + a_classes[class_id];
iss_data['id'] = item_id;
iss_data['cid'] = class_id;
iss_data['sel'] = selectable;
return iss_data;
};


3. then in the items structure we just call the function providing class id and item specific data:

Code:

var TREE_ITEMS = [
['projects',0,iss(1,-1, 1),
['softcomplex',0,iss(1,1),
['index.html',0,iss(3,21),
['title',0,iss(6,22)],
...


your implementation mey be different but approach is the same: move the long and repeating stuff somewhere so you can refer it from the multiple locations.
View User's Profile View All Posts By User U2U Member
Tolstoy
Member

Posts: 13
Registered: 5/25/2006
Member Is Offline
posted on 6/14/2006 at 07:40 AM Reply With Quote

Very cool, very powerful. Thanks!
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Multiple Trees
Frames Targeting
Icons and Styles Overloading
Event Handling
Performance Test
Version 1.2 features
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004