TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Register
 
The purpose of these forums is to discuss TurboCAD.  Please keep the discussion of other products to compatibility issues or how the other software’s can be used with TurboCAD.


Creating a block that will fire code when it is clicked
Read 2255 times
* March 24, 2011, 10:02:54 AM
Is it possible to create a block that will cause code to be executed when the block is clicked, double clicked,  right double clicked or ....?

Our current method first involves selecting the block we need followed by a click of a custom tool button.

It is more logical to create a custom block that has a built in method to start the custom tool code.

Any help would be appreciated.

CWC

Logged


* March 30, 2011, 11:42:07 AM
#1
After a bit of thought and some further online research I have decided what is needed is a command added to the right-click menu.  The menu I am referring to is the one that can be called once an object has been selected, I am unsure of the name of the menu.

Is it possible to send the correct variables to the GetToolInfo function in the "VB6 Tool Step By Step" as presented in the TurboCad Wiki (http://www3.turbocadcommunity.com/tiki-index.php?page=VB6+Tool+Step+By+Step) to place our custom tool buttons wherever we want them?

An excerpt of the code referenced above follows:
 
Code: [Select]
Public Function GetToolInfo(CommandNames As Variant, MenuCaptions As Variant, _
                            StatusPrompts As Variant, ToolTips As Variant, _
                            Enabled As Variant, WantsUpdates As Variant) As Long

    'resize each of the arrays to match the number of commands
    ReDim CommandNames(Me.NumTools)
    ReDim MenuCaptions(Me.NumTools, 2)
    ReDim StatusPrompts(Me.NumTools)
    ReDim ToolTips(Me.NumTools)
    ReDim Enabled(Me.NumTools)
    ReDim WantsUpdates(Me.NumTools)
   
    'set up the information  for the first commands
    CommandNames(0) = "MyVBTool|Line" 'set the menu location for the first tool
    MenuCaptions(0, 0) = "&Single Line" ' set the menu caption for the first tool
    MenuCaptions(0, 1) = "MyVBTool" 'Toolbar name
    StatusPrompts(0) = "Draw A Single Line" 'status bar prompt for the first tool
    ToolTips(0) = "Draws one line" 'mouse-over tooltip for the first tool
    Enabled(0) = True 'startup Enabled state for the first tool
    WantsUpdates(0) = False 'set to True if the tool's Enabled state may change

Specifically, can the values of CommandNames(0),   MenuCaptions(0, 0) and  MenuCaptions(0, 1) be modified to place our custom tool code button onto the right-click menu?

If the answer is "no" then I can move on to more fruitful ventures.

If it is possible, could someone suggest what the values of CommandNames(0),   MenuCaptions(0, 0) and  MenuCaptions(0, 1) will allow us to place  our custom tool code button onto the right-click menu?

If any of them are paying attention out there to this forum I think we might need the help of the TurboCad programmers.

Any help would be appreciated.

Thank You,
CWC

Logged