i have a form with an Eto.Forms.ToolBar to which i add commands without text (only image). These images are 64x64px however the ToolItems are displayed much smaller. I cannot find how to control the button size. I’ve tried this:
Hi @dale, thank you for this example which is probably only for Rhino 7. Using Rhino 6 i get this error:
Message: ‘Rhino.UI.Controls’ object has no attribute ‘RhinoButtonRow’
I’ve coded an alternative using just regular buttons with image too, there it respects my desired button size and scales the button images accordingly.
One follow up question as it is related. I am coding this since i need to have a cross platform toolbar which can be updated and distributed without too much work for RH6 (win) and RH7 (win and mac). There currently is no easy way to convert my windows toolbars (rui) to mac so i created this modeless dialog with button commands which works better than nothing. However, there is one problem i have no solution for yet:
If a user clicks on one of the “toolbar” buttons, i invoke a Rhino command for each button, eg. this:
! _-RunPythonScript ScriptName.py
The script gets called as it should and the dialog remains open but the command cannot be repeated, instead it just repeats the previous command (or the opening of the toolbar). Can i run a command in a way Rhino thinks it was run like a seperate command, so it is added to the repeat list ?
Do note that using ControlObject does not work on both platforms as it is the native control, in this case a WPF Button that contains both an WPF Image and TextBlock. See here for its implementation.
Also, Eto’s implementation for ButtonToolItem may change over time so the above may not always work.
Thank you @curtisw, i ended up using just simple Eto.Forms.Button items in a dynamic row since the ToolItem solution and the one using Rhino.UI.Controls.RhinoButtonRow both had the problem that i needed to click twice on the button to invoke the command. The first click did activate the dialog, the second then started the button command. Somehow, using simple buttons, this was not required so i kept it.