0

How to access default button images

asked 2010-08-16 14:48:33 +0800

purvita gravatar image purvita
9

Hi,

I want to use the default button images used for paging in my zul file. How do I access them.

Thanks
P

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2010-08-16 19:57:04 +0800

SimonPai gravatar image SimonPai
1696 1

Hi purvita,

You can extract the zul.jar and find the button images in src/archive/web/zul/img/button. The relevant images are btn-corner.gif, btn-ctr.gif, btn-x.gif, btn-y.gif.
If you were refering to the button in OS/default mold, it is the native browser button. You can use screen capture to get the images, but note that the OS button appears differently in different browsers.

Regards,
Simon

link publish delete flag offensive edit

answered 2010-08-17 12:09:32 +0800

purvita gravatar image purvita
9

Thanks for the help Simon.

I want to use the images in zul.jar\web\zul\img\paging\pg-btn.png

That image file contains all the buttons for the paging functionality and I an looking for a way to access the image for each individual button like page-next.

Thanks
P

link publish delete flag offensive edit

answered 2010-08-17 20:11:11 +0800

SimonPai gravatar image SimonPai
1696 1

The trick is to put the image as the background of a div tag, set its size, and use background-position property (with negative values) to choose the part you want to use.
For example, in web/js/zul/mesh/paging.css.dsp you can see:

<%@ taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" %>
.z-paging-btn .z-paging-first,
.z-paging-btn .z-paging-last,
.z-paging-btn .z-paging-next,
.z-paging-btn .z-paging-prev {
	background-repeat:no-repeat;
	cursor:pointer;
	height:21px;
	width:21px;
	padding:0;
	white-space:nowrap;
}
.z-paging-btn .z-paging-next {
	background-position: 0 0;
	background-image: url(${c:encodeURL('~./zul/img/paging/pg-btn.png')});
}
.z-paging-btn .z-paging-prev {
	background-position: 0 -21px;
	background-image: url(${c:encodeURL('~./zul/img/paging/pg-btn.png')});
}
.z-paging-btn .z-paging-last {
	background-position: 0 -42px;
	background-image: url(${c:encodeURL('~./zul/img/paging/pg-btn.png')});
}
.z-paging-btn .z-paging-first {
	background-position: 0 -63px;
	background-image: url(${c:encodeURL('~./zul/img/paging/pg-btn.png')});
}
<%--mouse over a button --%>
.z-paging-btn-over .z-paging-next {
	background-position: -21px 0;
}
.z-paging-btn-over .z-paging-prev {
	background-position: -21px -21px;
}
.z-paging-btn-over .z-paging-last {
	background-position: -21px -42px;
}
.z-paging-btn-over .z-paging-first {
	background-position: -21px -63px;
}
<%-- mouse click on a button --%>
.z-paging-btn-clk .z-paging-next {
	background-position: -42px 0;
}
.z-paging-btn-clk .z-paging-prev {
	background-position: -42px -21px;
}
.z-paging-btn-clk .z-paging-last {
	background-position: -42px -42px;
}
.z-paging-btn-clk .z-paging-first {
	background-position: -42px -63px;
}

In addition, it's highly recommended to use an element inspector like FireBug in FireFox, or the built-in inspector of Chrome to help you when you want to work on CSS customization.

Regards,
Simon

link publish delete flag offensive edit

answered 2010-08-18 15:24:02 +0800

purvita gravatar image purvita
9

Thanks.

I will see what I am able to do.
If I understand this correctly I will have to do this in the css.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-08-16 14:48:33 +0800

Seen: 633 times

Last updated: Aug 18 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More