TIP: Switch button positions for a cross-platform look

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

TIP: Switch button positions for a cross-platform look

Postby IT2Be » Thu Jan 15, 2004 6:38 pm

Too simple to think of but still:

Don't know how many of you develop crossplatform applications but windows positions it's ok and cancelbuttons opposite to the mac.

If you develop your own dialogs you have to keep that in mind or disregard this little issue. If you disregard it you don't need to anymore with the below solution.

Take the below code and make it a global method switchButtons. Call the method like 'global.switchButtons(formname, button1name, button2name) and the position of the two buttons will be switched. You now only have to identify the platform to call the function...

Good luck with it!

------------------
//switch button position for windows/mac
var x = forms[arguments[0]].elements[arguments[1]].getLocationX();
var y = forms[arguments[0]].elements[arguments[1]].getLocationY();

var xx = forms[arguments[0]].elements[arguments[2]].getLocationX();
var yy = forms[arguments[0]].elements[arguments[2]].getLocationY();

forms[arguments[0]].elements[arguments[2]].setLocation(x, y);
forms[arguments[0]].elements[arguments[1]].setLocation(xx, yy);


---
Title renamed for clarity - (mattman) 1/27/04
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby maarten » Fri Jan 16, 2004 12:23 am

8) cool!
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands


Return to How To

Who is online

Users browsing this forum: No registered users and 7 guests