Create a text box that contains a statement or statements, with no input required.

I have this code to create a table with a number of empty waves in it. I want to prompt the user to input their test results. See below

Function BuildDataTable(CtrlName):ButtonControl
String CtrlName
variable pts
Prompt Pts, "Number of Test Points:"
DoPrompt "Enter number of Points", pts
Make/D/O/N=(pts) FlowSet, FlowAct, TimedVol, TimeSecs, VolMeas, VolDry
Edit/N=DataTable Flowset; appendtotable FlowAct; Appendtotable TimedVol; Appendtotable TimeSecs;



END

So after the tables appears I want a window, similar to a "Prompt" window, to say something like "Please enter the test data in the following columns". With a button that will kill the window after its been read. Then the user enters data into each of the waves. DoPrompt wants to have some pulldowns or data entry and that is not needed here. Im sure I just dont know the command name for this. Thanks for the help.

ssmith
The operation you are looking for is DoAlert.

By the way, when you include Igor code please enclose the code in <igor> and </igor> tags so that it gets properly syntax-colored.

For example, your code becomes...

Function BuildDataTable(CtrlName):ButtonControl
 String CtrlName
 variable pts
 Prompt Pts, "Number of Test Points:"
 DoPrompt "Enter number of Points", pts
 Make/D/O/N=(pts) FlowSet, FlowAct, TimedVol, TimeSecs, VolMeas, VolDry
 Edit/N=DataTable Flowset; appendtotable FlowAct; Appendtotable TimedVol; Appendtotable TimeSecs;

END
My apologies. I have reread my post and it doesn't clearly stated what I'm trying to do. I want to pause execution of the function after the table is created, then enter in some test values into the table and then continue execution of the function which is supposed to use the entered values and calculate some results. The DoAlert function does not allow me to enter any values into the table.

Function BuildDataTable(CtrlName):ButtonControl
    String CtrlName
    NVAR G_Pinit, G_PH2O, G_Tcorr
    variable pts
    Prompt Pts, "Number of Test Points:"
    DoPrompt "Enter number of Points", pts
    Make/D/O/N=(pts) FlowSet, FlowAct, TimedVol, TimeSecs, VolMeas, VolDry
    Edit/N=DataTable   Flowset; appendtotable FlowAct; Appendtotable TimedVol; Appendtotable TimeSecs; Appendtotable VolMeas; Appendtotable VolDry
    DoAlert/T="Data Entry" 0, "Enter the collected data into the table and Press 'OK'"
    Volmeas = (TimedVol/(TimeSecs/60))
    VolDry = VolMeas*(298.15/(273.15+G_Tcorr))*((G_Pinit-G_PH2O)/1013.25)

END
Hmm... I suppose it could be a control panel with "Done" and "Cancel" buttons, and a table as the target window. But I think it might be more natural to use a table subwindow in your control panel.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
John, can you elaborate more please. I have zero experience with control panels and pause for user. Please explain the need for a control panel and what it must contain. By simply inserting a PAUSEFORUSER command there is no way to continue. I have attached a screen shot and inserted my code, but I am obviously missing something. After inputting some values into the table ans cannot continue. The table won't close and I have to use windows task manager to close down IGOR.

Function BuildDataTable(CtrlName):ButtonControl
    String CtrlName
    NVAR G_Pinit, G_PH2O, G_Tcorr
    variable pts
    Prompt Pts, "Number of Test Points:"
    DoPrompt "Enter number of Points", pts
    Make/D/O/N=(pts) FlowSet, FlowAct, TimedVol, TimeSecs, VolMeas, VolDry
    Edit/N=DataTable   Flowset; appendtotable FlowAct; Appendtotable TimedVol; Appendtotable TimeSecs; Appendtotable VolMeas; Appendtotable VolDry
   
    Pauseforuser DataTable
//  I want to enter values in the table at this point and when execution continues execute the next
//  two lines to complete the table.   
     Volmeas = (TimedVol/(TimeSecs/60))
     VolDry = VolMeas*(298.15/(273.15+G_Tcorr))*((G_Pinit-G_PH2O)/1013.25)

END
IGORScreenShot.jpg (379.81 KB)
You can read the detailed description of PauseForUser by executing this command: DisplayHelpTopic "Pause For User"

A control panel is an Igor window with user-programmed GUI. For your application, you need a pretty simple one: a button for "Done", a button for "Cancel" and possibly a TitleBox control with a message to the user.

Your example acts the way it does because PauseForUser prevents interaction with any window other than the table until the table window is killed. But there is no provision for killing the window that is accessible to the user (that is, you). Hence, the need for a control panel that has a button that will either accept the changes or cancel the changes and then kill the main PauseForUser window. Here is a very simple example that illustrates what I was describing:
Function Example()

    Make/O testwave
    Edit/N=PauseTable testwave
   
    fPausePanel()
    PauseForUser PausePanel, PauseTable
end

Function AcceptButtonProc(ba) : ButtonControl
    STRUCT WMButtonAction &ba

    switch( ba.eventCode )
        case 2: // mouse up
            // Do something that accepts the new data
            KillWindow PausePanel
            KillWindow PauseTable
            break
    endswitch

    return 0
End

Function CancelButtonProc(ba) : ButtonControl
    STRUCT WMButtonAction &ba

    switch( ba.eventCode )
        case 2: // mouse up
            // Do something to discard the results here (kill the wave?)
            KillWindow PausePanel
            KillWindow PauseTable
            break
    endswitch

    return 0
End

Function fPausePanel()

    NewPanel/W=(150,50,450,250)/N=PausePanel
    Button AcceptButton,pos={54.00,106.00},size={50.00,20.00},proc=AcceptButtonProc,title="Accept"
    Button CancelButton,pos={175.00,107.00},size={50.00,20.00},proc=CancelButtonProc,title="Cancel"
    TitleBox EditTitleBox,pos={64.00,54.00},size={151.00,19.00},title="Please edit the wave in the table"
EndMacro

Copy that code, paste into the Procedure window, then close the Procedure window. To run the example, execute Example() on Igor's command line. You will see a pair of badly-placed windows (the panel shouldn't really lie on top of the table) that allows you to edit the table or click the buttons in the panel, and nothing else. The action procedures for the panel buttons (AcceptButtonProc() and CancelButtonProc()) kill the windows. The panel is the PauseForUser main window, and when it is killed PauseForUser returns and the function stops executing. Killing the table isn't required, but you indicated that it should be temporary.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
John--
Thanks for the example. While walking back from lunch it dawned on me that I could use case statements that are selected via the buttons in a panel to do the different things I want. I was thinking the PauseForUser command had some sort of built in method to pause execution and then resume without much programming and that I was missing it. This example helps a lot.Thanks for taking the time to whip it up for me.

ssmith
John--
IS there a reason that the fPausePanel is described at the end and not in the beginning? Why do you use EndMacro instead of just End at the of the fPausePanel function? Your use of the STRUCT command is something I've never seen as well as the ba.eventcode. If you have time can you explain how these operate. I think I can get this to work with my more rudmentary IGOR skills and CASE statements. Thanks again for the help.

ssmith
It is possible to take a simpler approach. That is to break the task into two steps and require the user to initiate two steps instead of one. Here is an example:
Menu "Macros"
    "Setup/1", DemoSetup()
    "Process/2", DemoProcess()
End

Function DemoSetup()
    Make/O testWave
    DoWindow/F DemoTable
    if (V_Flag == 0)
        Edit/N=DemoTable testWave
    endif
   
    // This is not necessary if the user knows what he is doing
    DoAlert 0, "Enter data in the table and then choose Macros->Process"
End

Function DemoProcess()
    Print "DemoProcess: Processing started..."
    // Add your processing here
    Print "DemoProcess: Processing finished"
End


I prefer the two-step approach for three reasons:

1. PauseForUser is a tricky beast both from the Igor programmer's point of view (i.e., you) and in terms of its internal implementation in Igor

2. The two-step approach is simpler to program and to understand

3. The user is free to do whatever he wants between step 1 and step 2 and can use any tools that Igor provides *

* For example, the user can use the help system, search for text, put cursors on a graph, activate another window to copy and paste into the table, ....... In the PauseForUser method, the user can do only what the PauseForUser panel allows him to do.
ssmith911 wrote:
John--
IS there a reason that the fPausePanel is described at the end and not in the beginning? Why do you use EndMacro instead of just End at the of the fPausePanel function? Your use of the STRUCT command is something I've never seen as well as the ba.eventcode. If you have time can you explain how these operate. I think I can get this to work with my more rudmentary IGOR skills and CASE statements. Thanks again for the help.
ssmith

The order of the functions is not important.

The EndMacro instead of just End is a bit of sloppiness on my part- I mocked up the panel manually, saved a recreation macro, and then converted the macro into a function. I forgot to change that last line. As you can see, Igor's compiler tolerates that small inconsistency.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
So the order of the functions in the procedure window does not matter? So either of these will work? Is that because the compiler loads all of the functions into memory so they can be called at anytime?
//Function order in the procedure
//This will work...

Function One()
    //Lines of code
End

Function Two()
    //Lines of code
End

Function CallAll()
    One()
    Two()
End
//...As well as this?

Function CallAll()
    One()
    Two()
End

Function One()
    //Lines of code
End

Function Two()
    //Lines of code
End
hrodstein--
Thanks for the help. I took your suggestion and user DoAlert at the end of a function to provide info on how to proceed. I am using buttons in a controll panel to execute the functions in the proper order.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Function BuildDataTable(CtrlName):ButtonControl
    String CtrlName
    setdatafolder root:Packages:Regression
    NVAR G_Pinit, G_PH2O, G_Tcorr
    variable pts
    Prompt Pts, "Number of Test Points:"
    DoPrompt "Enter number of Points", pts
    Make/D/O/N=(pts) FlowSet, FlowAct, TimedVol, TimeSecs, VolMeas, VolDry
    Edit/N=DataTable   Flowset; appendtotable FlowAct; Appendtotable TimedVol; Appendtotable TimeSecs; Appendtotable VolMeas; Appendtotable VolDry
    DoALert 0, "1. Populate the first 4 columns with the test data.\r2. Once data entry is complete press the 'Process Table' button\rPress 'OK' to continue"
END

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Function ProcessTable(CtrlName):ButtonControl
String CtrlName
    String fold = Getdatafolder(0)
    Print "%s", fold
    Wave Volmeas, TimedVol, TimeSecs, VolDry, FlowAct
    Make/O/N=(numpnts(VolDry)) xwave, ywave
    NVAR G_Tcorr, G_Pinit, G_PH2O
    Volmeas = (TimedVol/(TimeSecs/60))
    VolDry = VolMeas*(298.15/(273.15+G_Tcorr))*((G_Pinit-G_PH2O)/1013.25)
    Xwave = FlowAct
    Ywave = VolDry
END

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ssmith911 wrote:
So the order of the functions in the procedure window does not matter? So either of these will work? Is that because the compiler loads all of the functions into memory so they can be called at anytime?

That's right.

But if you put all of the following code into one experiment it wouldn't compile because you have duplicate function names.

But maybe you meant this:

//Function order in the procedure
//This will work...

Function One()
    //Lines of code
End

Function Two()
    //Lines of code
End

Function CallAll()
    One()
    Two()
End


...As well as this?
Function CallAll()
    One()
    Two()
End

Function One()
    //Lines of code
End

Function Two()
    //Lines of code
End


--Jim Prouty
Software Engineer, WaveMetrics, Inc.