View Full Version : Status Bar Addition
dkh007.66346
2005-06-13, 01:50 AM
I'm working on a routine that adds a series of buttons to the Status Bar. It uses the ActiveX control available at http://www.manusoft.com I'm not real familiar with VLAX and I need a way to have the routine load without adding the buttons again when you launch a second drawing.
Here is a snip of the code for one of the buttons:
(defun SBB:Create ()
(vlax-create-object "AcadStatusBarButton.Button")
)
(defun SBB:cbOnCommandEND ()
(if (= (vlax-get-property *SBB:Button_END 'Pressed) :vlax-true)
(setvar "OSMODE" (+ (getvar "osmode") 1))
(setvar "OSMODE" (- (getvar "osmode") 1))
)
(princ)
)
(defun SBB:MakeButton ( ButtonText ButtonTip ButtonClickedCallback / ThisButton )
(setq ThisButton (SBB:Create))
(vlax-put-property ThisButton 'Text ButtonText) ;Text shown on the button
(vlax-put-property ThisButton 'Width 0) ;Auto-size
(vlax-put-property ThisButton 'TooltipText ButtonTip)
(vlax-put-property ThisButton 'TooltipEnabled :vlax-true)
(vlax-put-property ThisButton 'LispFunctionOnClicked (vl-symbol-name ButtonClickedCallback))
(vlax-put-property ThisButton 'Visible :vlax-true) ;Show it
(vlax-put-property ThisButton 'Pushlike :vlax-true)
ThisButton ;return the new button object
)
(setq *SBB:Button_END (SBB:MakeButton "END" "Toggle ENDpoint" 'SBB:cbOnCommandEND))
Any hint or suggestions? You can see the button is created with the last function. My thought is to scan to see if the buttons exist and then just assign the variables to it. But I'm not sure how to check if the VLAX object exist.
dkh007.66346
2005-06-13, 01:55 AM
Oh, one more thing. If you want to see the full program (with the bug) you can download it here: http://archsymb.com/index.php?option=com_content&task=view&id=61&Itemid=59
dkh007.66346
2005-06-14, 11:45 AM
For anyone keeping track, I thought I would post the solution. I got some help from Owen Wengerd of Manusoft, who wrote the original DLL. Instead of using a SETQ, I used a combination of (VL-BB-SET) & (VL-BB-REF) which both of these are global variables.
(defun SBB:Create ()
(vlax-create-object "AcadStatusBarButton.Button")
)
(defun SBB:cbOnCommandEND ()
(if (= (vlax-get-property (vl-bb-ref '*SBB:Button_END) 'Pressed) :vlax-true)
(setvar "OSMODE" (+ (getvar "osmode") 1))
(setvar "OSMODE" (- (getvar "osmode") 1))
)
(princ)
)
(defun SBB:MakeButton ( ButtonText ButtonTip ButtonClickedCallback / ThisButton )
(setq ThisButton (SBB:Create))
(vlax-put-property ThisButton 'Text ButtonText) ;Text shown on the button
(vlax-put-property ThisButton 'Width 0) ;Auto-size
(vlax-put-property ThisButton 'TooltipText ButtonTip)
(vlax-put-property ThisButton 'TooltipEnabled :vlax-true)
(vlax-put-property ThisButton 'LispFunctionOnClicked (vl-symbol-name ButtonClickedCallback))
(vlax-put-property ThisButton 'Visible :vlax-true) ;Show it
(vlax-put-property ThisButton 'Pushlike :vlax-true)
ThisButton ;return the new button object
)
(if (= (vl-bb-ref '*SBB:Button_END) nil)
(vl-bb-set '*SBB:Button_END (SBB:MakeButton "END" "Toggle ENDpoint" 'SBB:cbOnCommandEND))
)
You can download the final version from my website at: http://www.archsymb.com/index.php?option=com_content&task=view&id=61&Itemid=50 Cheers!
Tom Beauford
2005-06-14, 12:37 PM
Wasn't able to find the code, but it sounds interesting. I've never added a status bar button. Does it affect the ones already there and are the new ones controled by the status bar menu? Could you post another link to the full program (with or without the bug)? Oh, one more thing. If you want to see the full program (with the bug) you can download it here: http://archsymb.com/index.php?option=com_content&task=view&id=61&Itemid=59
dkh007.66346
2005-06-14, 12:46 PM
Wasn't able to find the code, but it sounds interesting. I've never added a status bar button. Does it affect the ones already there and are the new ones controled by the status bar menu? Could you post another link to the full program (with or without the bug)?
This link should take you directly to the page with the OSNAP Status Bar Buttons (this is version 1.1, hopefully bug free): http://www.archsymb.com/index.php?option=com_content&task=view&id=61&Itemid=50 If you have any problems, you can find it on my site at http://www.archsymb.com (http://www.archsymb.com/) and click on the "Free Stuff" link. The code is based on the free download from Manusoft. It does not affect any of the other status bar buttons. It builds from the right hand corner and works it way left. I have added one button for each OSNAP, so you will know the current status and be able to change them in real time and transparently.
noozybkk
2005-06-14, 01:37 PM
Hi again, Daniel.
Thought I'd post this in here to avoid running the risk of annoying anyone over in the wish list forum, being that the wish has now been granted :)
Not sure what happened here, have a look at the attached screen cap. I think this may be a bug in the original manusoft code, rather than a problem with your code. This happened on starting the third drawing in a session... the END button decided to wander off and spend his time sitting next to the MODEL button.
Robert.Hall
2005-06-14, 01:40 PM
Is there a way that I can add this to AutoCad without using the installer???
I do not have administrator privleges to use an installer of any kind.
dkh007.66346
2005-06-14, 02:08 PM
Hi again, Daniel.
Thought I'd post this in here to avoid running the risk of annoying anyone over in the wish list forum, being that the wish has now been granted :)
Not sure what happened here, have a look at the attached screen cap. I think this may be a bug in the original manusoft code, rather than a problem with your code. This happened on starting the third drawing in a session... the END button decided to wander off and spend his time sitting next to the MODEL button.
I'm not sure what is causing this, but it does only happen when you have 3 or more drawings open. It places the the gap after the last button that is in the down position. I guess this is something for version 1.2 I will look into how I'm checking for the state of the buttons, it could be related to the fact I scan the OSMODE between drawings, and there is really no need to do that.
dkh007.66346
2005-06-14, 02:10 PM
Is there a way that I can add this to AutoCad without using the installer???
I do not have administrator privleges to use an installer of any kind.
Yes there is. I can post a ZIP file with the DLL, BAT file and VLX. Without administrator rights, are you able to place a DLL file in your Windows/System folder? This is where the DLL need to reside, the BAT file then registers the DLL.
MikeM4OSU
2005-06-18, 03:37 PM
Hi Daniel, this is very cool, thanks. I am wondering if everything is working properly now that I have installed the new OSnap buttons, the tool tips that pop up over each button do not seem to be correct, has anyone else seen this before?
Mike
dkh007.66346
2005-06-19, 02:03 AM
Hi Daniel, this is very cool, thanks. I am wondering if everything is working properly now that I have installed the new OSnap buttons, the tool tips that pop up over each button do not seem to be correct, has anyone else seen this before?
Mike
In my haste, I just did a copy/paste of the first three buttons. So the tooltips just repeat themselves. It does affect how it works, just ends up being a little annoying. In version 1.2 I will fix the tool tips.
vBulletin® v3.6.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.