Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Open Numpad with VU.FbOpenDialogExtended

2022-08-17
2023-06-09
  • sean-barton - 2022-08-17

    When opening VisuDialogs.Numpad with VU.FbOpenDialogExtended everything appears to work as expected except for the OK button. The button, if pressed, seems to do nothing - even though the input action for the button on VisuDialogs.Numpad is to close the dialogue.

    I'm assuming that because there are checks to be made on the limits of the number entered the OK button can't simply exit, but highlights the min/max labels as red without closing the dialogue if the entered number is out of bounds, just like in the normal use of Numpad when a button is pressed.

    The reason I'm looking at this is to be able to open a numpad from a table cell selection for editing the cell value.

     

    Last edit: sean-barton 2022-08-17
  • sean-barton - 2022-08-22

    I am getting close to a solution, but with a problem updating the dialogue for feedback.

    Using the dialogue manager, I grab the interface to the dialogue and I can then update the dialogue visualization structure and set this update back on the dialogue. The trouble is, I can see the values are copied to the dialogue interface but they are quickly overwritten back to the previous values. How do I make the values of the updated dialogue structure "stick" to the dialogue?

    I mainly want to update the dialogue flags to show if a value entered is within set bounds.

    Apart from this problem, the dialogue updates the cell value properly and if the value entered is out of bounds, pressing the OK button does nothing. It just doesn't provide feedback as to the fact that the value is out of bounds.

     

    Last edit: sean-barton 2022-08-22
  • sean-barton - 2022-08-22

    Alright! I now have a fully functional VisuDialogs.Numpad with feedback using the VU.FbOpenDialogExtended. The solution to the above problem was to update the dialogue using the dialogue manager (instead of the dialogue interface) with an intermediate structure for type conversions from the dialogue interface - because the interface uses STRING instead of WSTRING (which the dialogue manager expects.)

     
    • kislov - 2022-08-23

      Please publish code snippet for this case.

       
  • hemuv - 2023-06-06

    Hi Barton,

    I am new to Codesys/Twincat and i have a similar kind of problem.
    Created my own visualization object and (use Visualization) chnaged it to NUMPAD type. I have to do this to change the Font on the NUMPAD to make it better visible. Everything works like the Visudialog.Numpad except the limit check that changes the min/max labels to red color when an input variable boundary check fails. Can you please guide me what went wrong with my chnage.

     
    • sean-barton - 2023-06-06

      What I did was to test if the entered value was in range of the min/max for the numpad I created, updating the flags variable of a temporary structure for the numpad. I then wrote this temporary structure back to the numpad through the dialogue manager using the SetDialogInterfaceValues method.

      I also interrupted the closing of the numpad if the value was outside this min/max range by sending the ENUM of "None" (VisuElems.VisuElemBase.Visu_DialogResult.None) to the dialogue interface reference using it's SetResult method, so the updated red text (as updated by the numpad visu based on the flags) could be seen.

       
      • hemuv - 2023-06-07

        Hello Barton,

        Thank you for the quick responce.

        The Numpad object closing was interupted like the normal VisuDialog.Numpad and stays where it is. Only the text changing to RED is missing due to flags value which was lost. can you please provide me the example "dialogue manager using the SetDialogInterfaceValues method".

         
  • sean-barton - 2023-06-09

    Attached is an example that works for me.

     

Log in to post a comment.