Code Red > AutoLISP (Vanilla / Visual)

Simulate click on toolbar

(1/9) > >>

hmspe:
Is there a way to simulate clicking a toolbar button using lisp?

I'm running Bricscad and I have a parent toolbar that has a flyout for different scale factors on one of the parent's buttons.  I have the parent set up to show the last-clicked icon from the flyout, but I can't find a way to "pre-load" the button icon when I load a new drawing so it shows the appropriate scale based on the data in the drawing.  I can manually change the icon on the parent using vla-setbitmaps but that resets the "own icon" setting for the parent button so it is locked to whatever icon is assigned through vla-setbitmaps and the parent button no longer changes based on clicks on the fly-out.  I'm thinking that if there is a way to set the "active" button on the fly-out the associated button on the parent toolbar should follow.

Thanks.

roy_043:
I don't think a toolbar click can be simulated using Lisp. But it should be possible to use (vla-setbitmaps) to change the parent icon every time one of the flyout buttons is activated.

hmspe:
Roy,

Thanks.  That's what I've been doing, but it is not particularly pleasant.  There are 17 buttons on the toolbar, with the flyout being the last.  It takes almost 2 seconds for the toolbar to update most of the time since the whole parent toolbar has to be updated and repainted.  Sometimes it takes much longer, although I haven't been able to figure out why.  It might be because the bitmaps are on the server, similar to the issue with MTEXT with reading fonts from a network drive.  I wouldn't mind having the delay once on startup if I could find a way to reset "own bitmap" on the parent toolbar to no, but I don't see a way to do that, either. 

roy_043:
Maybe the image type is important. With local 16x16 .bmp files the speed is acceptable I think. Certainly less than half a second.

I am attaching a .zip file that I have used to report a bug to the Bricsys team.

Place all files in the same folder and open a dwg in that folder.
The (c:Test) function will change the first bitmap in the 'Draw' toolbar.

hmspe:
Roy,

Thanks for the reply and the testing.  You are seeing what I see.  It is not a "show stopper", but it is irritating to have to wait for the toolbar to redraw, especially since sometimes the delay is closer to 10 seconds.  I haven't been able to track down why the time varies.  There are only 3 Cad stations here and the LAN is gigabit.

Using local bitmaps does appear to be faster than using bitmaps on the server, but changing to local files for bitmaps, blocks, fonts, etc., is not practical because of the work that would be required to keep all the local copies synchronized on all the computers. 

I have filed a report asking if setting "own icon" to 'on' when vla-setbipmaps is run is intended or not and asking if there is a way to reset "own icon".  I'll post here when I hear from Bricsys.

Navigation

[0] Message Index

[#] Next page

Go to full version