MiniToolbarValueEditor. ValueEditor and integers

MiniToolbarValueEditor. ValueEditor and integers

Ivan_Sinicyn
Advocate Advocate
123 Views
2 Replies
Message 1 of 3

MiniToolbarValueEditor. ValueEditor and integers

Ivan_Sinicyn
Advocate
Advocate

Hi all,

I'm puzzled. How to properly configure MiniToolbarValueEditor to accept only integers with automatic highlighting of fractional values in red, but without having to create new functions?

I tried writing MiniToolbarValueEditor.Precision Property, but I get an error



Sub Main()
    Dim Inventor As Inventor.Application = ThisApplication
    Dim interactEvents As InteractionEvents
    Dim stillSelecting As Boolean = True
    Dim toolBar As MiniToolbar
    Dim valueEditor As MiniToolbarValueEditor
    
    interactEvents = inventor.CommandManager.CreateInteractionEvents
    interactEvents.InteractionDisabled = False
    
    toolBar = interactEvents.CreateMiniToolbar()
    valueEditor = toolBar.Controls.AddValueEditor("MyValueControl", "", ValueUnitsTypeEnum.kLengthUnits, "123")
    valueEditor.MinimumValue = 0.1
    valueEditor.CanValueBeEqualToMinimumValue = True
    
    AddHandler interactEvents.OnTerminate, Sub()
        stillSelecting = False
    End Sub
    
    toolBar.ShowApply = False
    toolBar.ShowOptionBox = False
    toolBar.ShowOK = False
    toolBar.Visible = True
    
    interactEvents.Start()
    Do While stillSelecting
        inventor.UserInterfaceManager.DoEvents()
    Loop
    
    interactEvents.Stop()
    inventor.CommandManager.StopActiveCommand()
    toolBar.Delete()
End Sub


wqw.png

 

INV 2025.3
0 Likes
124 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

This is just a quick, educated guess, but maybe when creating the value editor with the MiniToolbarControls.AddValueEditor method, specify unitless type units (ValueUnitsTypeEnum.kUnitless), instead of length type units.  That should help keep all entered values as integers.  Not sure about the highlighting in red part though.  I have used MiniToolbars several times before, but not extensively yet, so have not attempted pushing the limits of their abilities yet.  Probably will before long though. 😉  They are pretty convenient.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

Ivan_Sinicyn
Advocate
Advocate

 

@WCrihfield 

 

Thanks for the reply.
ValueUnitsTypeEnum.kUnitless simply allows you to work with dimensionless values and does not restrict or warn in any way when entering fractional numbers.

I've tried dozens of variants, but still can't win. I had to make a handler.

INV 2025.3
0 Likes