Alternative dialog box

LabVIEW one-button and two-button dialogs are great but present some issues. The first one is permanency: they don't disappear unless the user clicks one button. This can be problematic if you need the code to continue executing even if there's not a human watching. Second, and less serious to an extent, they resize automatically to the text length; that can lead to really big gray boxes in the screen.

So here you have an alternative dialog box. The main difference is, even being modal, it closes by itself if the time consumes without user action. In that case, the default value is returned (true for one-button mode, false for two buttons). You can select the waiting time in seconds (20 by default).

Download (VI for LabVIEW 2016)

Vertical scrollbar? Only when needed

Surely it's a very simple VI, but please consider this piece of code:

What we are doing here is to check if a vertical scrollbar is needed. Usually the vertical scrollbar is grayed out if the text area is not overflowing, but it's still there and that's pretty ugly. The ideal situation would be to hide it completely if no scrolling is available.

So we read the text area height, apply the size-to-text method (that only affects height) and compare the new height. If it is bigger, a vertical scrollbar is necessary (and don't forget to return the text area to its original size).

Comentarios

Entradas populares de este blog

SNMP library for LabVIEW

Base64 Encoding

Retrieve CPU temperature