Create a text box that contains a statement or statements, with no input required.
ssmith911
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
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...
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
November 6, 2017 at 11:37 am - Permalink
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
November 6, 2017 at 01:18 pm - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
November 6, 2017 at 02:52 pm - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
November 6, 2017 at 02:53 pm - Permalink
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
November 7, 2017 at 07:31 am - Permalink
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:
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
November 7, 2017 at 09:41 am - Permalink
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
November 7, 2017 at 10:31 am - Permalink
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
November 7, 2017 at 10:46 am - Permalink
"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.
November 7, 2017 at 09:44 pm - Permalink
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
November 8, 2017 at 09:07 am - Permalink
//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
November 8, 2017 at 01:22 pm - Permalink
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
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
November 8, 2017 at 01:32 pm - Permalink
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
November 8, 2017 at 08:28 pm - Permalink
Yes that is exactly what I meant. Thanks for the info.
ssmith
November 9, 2017 at 05:40 am - Permalink