Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Contributor
Posts: 13
Registered: ‎08-23-2016

SDK : Modify Custom Toolbar button

[ Edited ]

Hi,

 

Is there a way to get a cutom toolbar button and to change its properties, like the tooltip, the icon url etc.. ?

 

for example, I add a 'Hello World' button in the toolbar : 

var iconMoveUrl = "url 1"

$GP.ui.toolbar.add({ iconCls: 'x-btn-icon',
icon: iconMoveUrl,
xtype: "tbbutton", text: "Hello World!", handler: function (b) { $GP.ui.info("Hello World!"); } });

then, while I'm using the Geoportal, I want to modify dynamically this button and change the icon  : 

iconMoveUrl = "url 2"

 

Can anyone help ?

 

Many thanks,

David

Highlighted
Technical Evangelist
Posts: 1,118
Registered: ‎09-11-2015

Re: SDK : Modify Custom Toolbar button

Hi David,

 

  1. Set button id parameter (e.g. id: 'my-new-button1')
  2. Use this parameter to find the button - var btn = Ext.getCmp('my-new-button1')
  3. Define the image in CSS and change the CSS - btn.setIconClass('class-name')

See the full ExtJS documentation here: http://docs.sencha.com/extjs/2.3.0/#!/api/Ext.Button

 

Regards,

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.