PEARL Procedures  rev-distro-2.1.0-1-gb7390cb-dirty
Igor procedures for the analysis of PEARL data
pearl-gui-tools.ipf
Go to the documentation of this file.
1 #pragma rtGlobals=3 // Use modern global access method and strict wave access.
2 #pragma IgorVersion = 6.1
3 #pragma ModuleName = PearlGuiTools
4 #pragma version = 1.01
5 
6 // Miscellaneous GUI tools
7 // * progress bar
8 
9 // created: matthias.muntwiler@psi.ch, 2013-11-14
10 // Copyright (c) 2013 Paul Scherrer Institut
11 // $Id$
12 
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 // http://www.apache.org/licenses/LICENSE-2.0
17 
18 function display_progress_panel(title, message, progress_max)
19  string title
20  string message
21  variable progress_max
22 
23  NewPanel /K=1 /N=ProgressPanel /W=(200,200,402,260) as title
24  TitleBox t_message,pos={2,2},size={189,13},title=message
25  TitleBox t_message,frame=0
26  ValDisplay vd_progress,pos={2,20},size={198,13}
27  ValDisplay vd_progress,limits={0,progress_max,0},barmisc={0,0},mode= 3,value= _NUM:0
28  Button b_abort,pos={74,38},size={50,20},title="Abort"
29  DoUpdate /W=ProgressPanel /E=1
30 end
31 
32 function update_progress_panel(progress, [message, progress_max])
33  // returns true if the user clicked the Abort button
34  variable progress
35  string message
36  variable progress_max
37 
38  if (!ParamIsDefault(message))
39  TitleBox t_message,title=message,win=ProgressPanel
40  endif
41  if (ParamIsDefault(progress_max))
42  ValDisplay vd_progress,value=_NUM:progress,win=ProgressPanel
43  else
44  ValDisplay vd_progress,limits={0,progress_max,0},value=_NUM:progress,win=ProgressPanel
45  endif
46  DoUpdate /W=ProgressPanel
47  return (v_flag == 2)
48 end
49 
51  KillWindow ProgressPanel
52 end
variable kill_progress_panel()
variable display_progress_panel(string title, string message, variable progress_max)
variable update_progress_panel(variable progress, string message=defaultValue, variable progress_max=defaultValue)