Servoy.com left expandable vertical menu

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Moderator: edward

Servoy.com left expandable vertical menu

Postby erdione on Wed Feb 03, 2010 1:54 pm

Does anybody have any samples or tips to create a menu with 1 to 3 level like servoy.com left expandable menu and compatible with smart and webclient?
Fabrice
Erdi One
Lyon-France
Servoy Alliance Network Developer
erdione
 
Posts: 95
Joined: Thu Feb 01, 2007 12:19 pm

Re: Servoy.com left expandable vertical menu

Postby Gordon on Thu Feb 04, 2010 9:01 am

Hi

You could try building the menu in html and rendering it each time the user selects an option ie re draw the whole thing.

This is a an extremely rough example but does work. Servoy renders this sufficiently quickly that you can do some pretty cool stuff with decoration and the like too.


//variable to stick the result into that is displayed on the page as an un editable html area
var htmlField = '';

//This is the function you want the clicked menu to call
function htmlFieldAction()
{
application.output('Link number: '+arguments[0]+' clicked...');

}

//this renders the html in the first place. Note I have had to stick an IF in here to change the font size depending on whether the user is using web or
//smart client. Its probably a css issue that I have not tracked down yet and will be blindingly obvious to others

function populateHtml()
{
var navHtml = '';

navHtml = '<html><head>';
navHtml += '<style type="text/css">';
navHtml += 'a {color:#999999; text-decoration: none; font-size: 9px; font-weight:450;}';
navHtml += 'a:hover {color:#717171}';
navHtml += 'a.on {color:#363636; font-weight:bold }';
//navHtml += 'a:link{color:#000000}';
navHtml += '</style></head><body>';

// Simple loop, make 5 menu items
for(var i=0; i<5; i++)
{
navHtml += '<a href="javascript:htmlFieldAction('+i+')">This is link '+i+'</a><BR>';
}

navHtml += '</body></html>';

htmlField = navHtml;
}

Cheers
Gordon
Gordon McLean
Click Digital Media Ltd
SAN Developer
www.clickdigital.com
User avatar
Gordon
 
Posts: 162
Joined: Thu Mar 17, 2005 7:05 pm
Location: UK


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 2 guests