cancel
Showing results for 
Search instead for 
Did you mean: 

[?] NX10 - Block UI Styler - String Object - KeyPress Event - VB.NET

Creator
Creator

Hello,

 

I created a custom UI using the Block UI Styler and NXopen/VB.NET.

 

In this UI I have a String Object, basically a textbox, in which I am entering a password. The value IsPassword is set to True (Displaying the typed string as PW Char *).

Now I am trying to, instead pressing a button to confirm, using the Enter Key, but the String Object does not have any kind of enter key behavior control.

 

The reason is to just become more user-friendly.

 

Could I simply create a keypress event, e.g.

 

Function MyTextBox1_KeyPress(ByVal keyASCII as BlockUI.....).....

End Function

 

I basically do not know how to create such a function, in case you're wondering about my code example...

 

Looking forward to your response.

 

Regards

 

Mathieu

2 REPLIES

Re: [?] NX10 - Block UI Styler - String Object - KeyPress Event - VB.NET

Creator
Creator

Okay, I figured out how to do it in this case...

 

Public Function update_cb(ByVal block As NXOpen.BlockStyler.UIBlock) As Integer
        Try
            If block Is toggleWorking Then
                If toggleWorking.value Then togglePDI.Value = False : toggleRelease.Value = False : toggleNo.Value = False

            ElseIf block Is togglePDI Then
                If togglePDI.value Then toggleWorking.Value = False : toggleRelease.Value = False : toggleNo.Value = False

            ElseIf block Is toggleRelease Then
                If toggleRelease.value Then togglePDI.Value = False : toggleWorking.Value = False : toggleNo.Value = False

            ElseIf block Is toggleNo Then
                If toggleNo.Value Then toggleWorking.Value = False : togglePDI.Value = False : toggleRelease.Value = False

            ElseIf block Is toggleSave Then
                If toggleSave.Value Then toggleExport.Value = False : toggleExportOnly.Value = False

            ElseIf block Is toggleExport Then
                If toggleExport.Value Then toggleSave.Value = False : toggleExportOnly.Value = False

            ElseIf block Is toggleExportOnly Then
                If toggleExportOnly.Value Then toggleSave.Value = False : toggleExport.Value = False

            ElseIf block Is stringPassword Then 'just enter code here...
                If stringPassword.Value = password Then group.Show = True : group0.Show = True : groupPassword.Show = False : _
                toggleWorking.Value = True : togglePDI.Value = False : toggleRelease.Value = False
            End If
        Catch ex As Exception
            theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
        End Try
        update_cb = 0
    End Function

Just had to enter the code at the right spot...

 

 

Regards

 

Mathieu

Re: [?] NX10 - Block UI Styler - String Object - KeyPress Event - VB.NET

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

When you will press enter, it will trigger an update CB for your string block. Use the UpdateCB function that is automatically created in your UI class.