How to check the buttondefinition.standardicon status

How to check the buttondefinition.standardicon status

bradeneuropeArthur
Mentor Mentor
187 Views
4 Replies
Message 1 of 5

How to check the buttondefinition.standardicon status

bradeneuropeArthur
Mentor
Mentor

How can I check a buttondefinition having the correct standardicon.

I tried with

Buttondefinition.standarducon = myicon, but is returning false.

Myicon is on the Button and part of the Button displayed. I only want to check and the check is not working.

But that is not working 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
188 Views
4 Replies
Replies (4)
Message 2 of 5

BM_Ashraf
Advocate
Advocate

Hi Arthur,

To get your Button working correctly
https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=ControlDefinitions_AddButtonDefinition

 

Syntax

ControlDefinitions.AddButtonDefinition( DisplayName As String, InternalName As String, Classification As CommandTypesEnum, [ClientId] As Variant, [DescriptionText] As String, [ToolTipText] As String, [StandardIcon] As Variant, [LargeIcon] As Variant, [ButtonDisplay] As ButtonDisplayEnum ) As ButtonDefinition

 

1- [StandardIcon] As Variant : Make sure that your icon size is 16x16 pixel (.bmp)

2- [LargeIcon] As Variant : Make sure that your icon size is 32x32 pixel(.bmp)

 

 

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.

Blue Mech

Add-ins for Inventor!

0 Likes
Message 4 of 5

bradeneuropeArthur
Mentor
Mentor

@Frederick_Law 

Seems that it does not work indeed.

I would have hoped that I could test if the button contains a specific icon.

What I try is the following:

I have a red icon and I have a green icon.

I change the icon for the button from red to green and that works fine.

 

I want if I press the button that the icon changes from red to green

and if I press again I want to change it from green to red.

Since I am not able to check what button is on the button I can not easily change it like "on press if red than green if green than red"

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 5

Frederick_Law
Mentor
Mentor

What color is it when IV start? Green? Red?  Same at last run?

Add variable to store icon color.  When clicked, change icon and variable.

 

The save last run, you'll need to setup Settings in VS.

I use this to set dialog box to same location on last run:

VSSettings-01.jpg

      If (My.Settings.LastX <> 0) And (My.Settings.LastY <> 0) Then
        m_PropCopy.StartPosition = Windows.Forms.FormStartPosition.Manual
        m_PropCopy.Location = New Drawing.Point(My.Settings.LastX, My.Settings.LastY)
      End If

 

Use Move Event to save LastX, Y:

  Private Sub FPropCopy_Move(sender As Object, e As EventArgs) Handles Me.Move
    My.Settings.LastX = Location.X
    My.Settings.LastY = Location.Y
    My.Settings.Save()
  End Sub

 

If not, you'll need to load icon into byte array and compare byte by byte.

0 Likes