Create a button from an icon image

Hello all,

I am interested in creating button from an icon image. Let's say a save button (not in a toolbar, but a standard button) from the icon (Icon icon_save = addr_ 80).

I would like to do this in the same fashion as an arrow button

DBE down = button(arrowBox, downArrow, doNothing)

However, DXL being what it is I cannot seem to make it work correctly. Is there a way to achieve this or has Rational (IBM) intentionally made it impossible to create personalized buttons.

Thanks for your help
PatrickGuay - Fri Sep 21 13:01:22 EDT 2012

Re: Create a button from an icon image
Mathias Mamsch - Fri Sep 28 15:48:34 EDT 2012

Well it is probably not intentionally, and it was before IBM/Rational that those buttons were introduced. Nevertheless I tried and it seems not possible without bad hacks. The Arrow__ type that the button function takes is just an integer constant (unlike Icon). And since there is no perm that will load a different Arrow__ I guess you are out of luck. So those 11 arrows seem all you get:
 

DB x = centered "Arrows" 
 
void func(DBE) { 
}
 
int i; for (i = 1; i < 12; i++) {
   Arrow__ ar = addr_ i
   button (x, ar, func) 
}
 
show x

 


Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Create a button from an icon image
PatrickGuay - Mon Oct 01 08:38:04 EDT 2012

I was afraid that DOORS could not handle more image buttons. Thanks for the snippet. In order to generate a refresh button I placed a 40*40 pixel image in the program files path where the arrow images are located and named it ar_all (the all-ways arrow). Now when I call this arrow the refresh button is shown.
However, as a major drawback I have zapped the all-ways arrow (it is not really a useful arrow for me and I refer to have a refresh button than an all-ways arrow).

A second consideration is getting the file to all users so that they no longer get the all-ways arrow but instead the refresh. We have an automatic SVN scyncronization script that takes care of that for users who do not have admin rights on their PCs. However, anyone wanting to replace an image for another will have to take care of this... Maybe your IT department can push the image out, in the correct path, for all user, for you.

Patrick
Attachments

attachment_14892476_Capture.JPG