Software Archive
Read-only legacy content
17060 Discussions

InputBox in QuickWin?

sabalan
New Contributor I
1,314 Views
Does anybody know if there is something like Visual Basic's InputBox function to be called in QuickWin? (A little dialog with OK- and Cancel-buttons and an Edit box). Perhaps something like MESSAGEBOXQQ?

Sabalan.
0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,314 Views
It's easy to create your own with a simple dialog box and an edit control. It's only two lines of Fortran source - DlgModal and DlgGet.

Steve
0 Kudos
sabalan
New Contributor I
1,314 Views
Steve, Thanks for the tip. Maybe I should explain the problem more detailed: I have a dialog in QuickWin with several buttons and Edit boxes. What I wished was to open a new simple dialog when I click one of the buttons in the first dialog, to make it possible for the user to enter a value. I can do this in VB with just one line:

MyVariable=Val( InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile, context]))


This opens a little, predesigned dialog, without losing the first dialog (or "form"), with an Edit box and 2 buttons: OK and Cancel. I don't even need to check if the OK or Cancel button was clicked or Enter was pushed. MyVariable is going to get a value from Edit box, or 0 if Cancel is clicked.

But I have been thinking, writing, coding, testing, reading N. Lawrence's book, tearing my hair, and have not been able to do this in 2 Fortran lines! What I have to do is as follows:

I have to design a new dialog in Resource Editor with 2 Edit boxes: 1 without border and "Read only" to show the prompt (above), and the other as an ordinary Edit box. This dialog can be called IDD_DIALOG2. Then:

Several variable declarations and a COMMON, and:

       Status = DlgInit (IDD_DIALOG2, InputData) ! the first dialog disappears 
Status = DlgSet (InputData, IDC_EDIT1, Trim(Prompt)) ! Show preset Prompt
Write (Default,'(F8.4)') MyDefaultValue
Status = DlgSet( InputData, IDC_EDIT2, Trim(AdjustL(Default)))
Status = DlgSetSub( InputData, IDC_EDIT2, UpdateValue )
Resp = DlgModal (InputData)
If (Resp == 1) Then
MyVariable = CallBackVar ! CallBackVar should be shared through a COMMON
End If
Call DlgUninit (InputData)
Goto ? ! to DlgInit the first dialog


I Have to create a callback subroutine UpdateValue too, with SELECT CASE, and COMMON, and variable declarations, to update the CallBackVar. And forget about controlling the position of the dialog and help facilities (as I could do with VB InputBox).

I think that I should create an own function to do this, because I have to use such a thing very often. But I appreciate very much if you could show an easier way for that (although not just in 2 Fortran lines!). As I wrote in my question, something like MESSAGEBOXQQ would be ideal.

Regards,

Sabalan.
0 Kudos
Reply