Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Button with image

Post Reply
dpaulajr
Posts: 3
Joined: Sat Jan 28, 2012 11:29 pm
Location: Brazil

Button with image

Unread post by dpaulajr »

Hi, Steven!

1. Is it possible to put a image in a button?

2. I am migrating a system that has a main page like
DATAPETI 1.zip
(48.44 KiB) Downloaded 382 times
. Can I do it in nuBuilder?

Thanks

dePaula Jr.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Button with image

Unread post by admin »

dpaulajr,

Sorry, not with nuBuilder.


Steven
zazzium
Posts: 84
Joined: Mon Jul 04, 2011 12:52 am

Re: Button with image

Unread post by zazzium »

Here is one way how it could be done with jquery.
The code goes to CustomCode/Javascript.
(The function 'buttonPicture' assumes that you have a 'icons' folder in productionnu2 folder, where the icons are)

Code: Select all

function nuLoadThis(){
    buttonPicture("#nuActionSave","disk.png");
    buttonPicture("#nuActionClone","disk_multiple.png");
    buttonPicture("#nuActionDelete","delete.png");
}

function buttonPicture(id,pic){
    $(id).css("padding-left","25px");
    $(id).css("background-image","url(icons/"+pic+")");
    $(id).css("background-repeat","no-repeat");
    $(id).css("background-position","5px 4px");
}
Image

But way cooler thing u could to with it is to add custom value to a button .
Like the button 'Test button (3)' where the number 3 could be a count result from MySql query.

Code: Select all

function nuLoadThis(){
    var somevalue = 3; 
   buttonValue("#testButtonFieldName",somevalue);

}
function buttonValue(id,val){
    $(id).attr('value', $(id).attr('value')+' ('+val+')');
}

i hope it helps
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Button with image

Unread post by admin »

zazzium,

This is nice!

With a slight change we you can use images stored in nuBuilder

Code: Select all

function nuLoadThis(){
    buttonPicture("#nuActionSave",getImage("disk");
}

function buttonPicture(id,pic){
    $(id).css("padding-left","25px");
    $(id).css("background-image","url("+pic+")");
    $(id).css("background-repeat","no-repeat");
    $(id).css("background-position","5px 4px");
}
Capture.PNG
Capture.PNG (15.81 KiB) Viewed 4518 times
Steven
Post Reply