Skip to Content
0
Mar 22, 2006 at 03:38 PM

How to display a button with an icon?

214 Views

Hi,

I'd like to display an SAP-icon on a button.

In this thread How can I show an Icon in the tapStripItem-title?

Thomas Jung gave the following example:

> I don't know if this definetely works with tabstrips

> items but it does work with buttons and toolbar

> buttons. What I do is create a BEE and render that

> to a string. I then use that string as the text of

> the element I want to place my image into:

>

>   <%
>   data image type ref to cl_htmlb_image.
>   data: image_string type string.
>   create object image.
>   image->id = `UserSelectionCancel2`.
>   image->src = cl_bsp_mimes=>sap_icon( `ICON_CHECKED` D`).
>   image->tooltip = ``.
>   clear image_string.
>   image_string = image->IF_BSP_BEE~RENDER_TO_STRING( G( page_context ).
>   %>
> <xhtmlb:toolbarButton id            = "UserSelectionCancel"
> onClientClick = "closeiframe();"
> enabled       = "<%= enabled %>"
> text          = "<%= image_string %>" />

I didn't find anything else about this topic and

tried to adopt this for a button, but that doesn't work for me either.

<htmlb:button id            = "byButt"
   text    = "<%= image_string %> ENTER"
   onClick = "myClickHandler"  />

Is there a way/documentation to get this done?

Thanks in advance.

Cheers.

-Alf