source: cprs/branches/tmg-cprs/m_files/TMGXDLG.m@ 1099

Last change on this file since 1099 was 796, checked in by Kevin Toppenberg, 15 years ago

Initial upload

File size: 86.7 KB
Line 
1TMGXDLG ;TMG/kst/M <--> Xdialog Interface ;03/25/06
2 ;;1.0;TMG-LIB;**1**;09/21/04
3
4 ;"M <--> Xdialog Interface
5
6 ;"+------------------------------------------------------------+
7 ;"| O P E N - V I S T A C O D E |..
8 ;"+------------------------------------------------------------+ :
9 ;"| | :
10 ;"| M <--> Xdialog Interface | :
11 ;"| | :
12 ;"| Kevin Toppenberg,MD | :
13 ;"| Started 9-21-04 | :
14 ;"| GNU License Applies | :
15 ;"| | :
16 ;"| Purpose: Linux command 'Xdialog' (and 'dialog') | :
17 ;"| provide a convenient graphic interface that | :
18 ;"| can be accessed in GT.M via the ZSYSTEM command | :
19 ;"| This library is a wrapper for Xdialog. | :
20 ;"| Note: Xdialog requires the X display system. This is a | :
21 ;"| true GIU interface. 'dialog' provides the same | :
22 ;"| functionality in a character-based environment | :
23 ;"| The command Xdialog should be in /usr/bin. If not, | :
24 ;"| it may simply be copied into place. | :
25 ;"| A good web site that documents Xdialog is: | :
26 ;"| http://xdialog.dyns.net/ and | :
27 ;"| http://thgodef.nerim.net/xdialog/doc/index.html | :
28 ;"| http://linuxgazette.net/101/sunil.html | :
29 ;"+------------------------------------------------------------+ :
30 ;" :............................................................:
31
32 ;"Note: Some of the following names are longer than 8 characters.
33 ;" However, the first 8 characters are . You may leave
34 ;" off all characters > 8 -- but I put them in for 'beauty'
35
36 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
37 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
38
39 ;"Higher-level Interface (API)
40 ;"-------------------------------
41
42 ;"SetupConsts()
43 ;"KillConsts()
44 ;"ChClrScr()
45
46 ;"$$YesNo^TMGXDLG(Text,width,height)
47 ;"$$Msg^TMGXDLG(Title,Text,width,height,Modal,x,y)
48 ;"$$Info^TMGXDLG(Text,width,height,timeout,Modal,x,y)
49 ;"$$Edit^TMGXDLG(file,width,height,Results,x,y)
50 ;"$$Log^TMGXDLG(file,width,height,Modal,x,y)
51 ;"$$Text^TMGXDLG(file,width,height,Modal,x,y)
52 ;"$$Tail^TMGXDLG(file,width,height,Modal,x,y)
53 ;"$$Input^TMGXDLG(Title,width,height,InitText,Result,x,y)
54 ;"$$Input2^TMGXDLG(Title,width,height,Label1,Init1Text,Label2,Init2Text,Result2,x,y)
55 ;"$$Input3^TMGXDLG(Title,width,height,Label1,Init1Text,Label2,Init2Text,Label3,Init3Text,Result2,Result3,x,y)
56 ;"$$RadioList^TMGXDLG(Text,List,width,height,x,y)
57 ;"$$FileSel^TMGXDLG(Title,InitFile,width,height,x,y)
58 ;"$$DirSel^TMGXDLG(Title,InitDir,width,height,x,y)
59 ;"$$DateSel^TMGXDLG(Text,width,height,InitDay,InitMonth,InitYear,x,y)
60 ;"$$TimeSel^TMGXDLG(Text,width,height,InitHour,InitMinute,InitSecond,x,y)
61 ;"$$FontSel^TMGXDLG(InitFont,width,height,x,y)
62 ;"$$Combo^TMGXDLG(Text,width,height,List,x,y)
63 ;"$$Range^TMGXDLG(Text,width,height,min,max,init,x,y)
64 ;"$$Range2^TMGXDLG(Text,width,height,label1,min1,max1,init1,label2,min2,max2,init2,Result2,x,y)
65 ;"$$Range3^TMGXDLG(Text,width,height,label1,min1,max1,init1,label2,min2,max2,init2,label3,min3,max3,init3,Result2,Result3,x,y)
66 ;"$$Spin^TMGXDLG(Text,width,height,min,max,label,init,x,y)
67 ;"$$Spin2^TMGXDLG(Text,width,height,label1,min1,max1,init1,label2,min2,max2,init2,Result2,x,y)
68 ;"$$Spin3^TMGXDLG(Text,width,height,label1,min1,max1,init1,label2,min2,max2,init2,label3,min3,max3,init3,Result2,Result3,x,y)
69
70
71
72 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
73 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
74
75
76 ;"Lower-level Interface (API)
77 ;"-------------------------------
78 ;"xyesno(Options,Results,Modal)
79 ;"xmsg(Options,Results,Modal)
80 ;"xinfo(Options,Results,Modal)
81 ;"xguage(Options,Results,Modal)
82 ;"xprogress(Options,Results,Modal)
83 ;"xinput(Options,Results,Modal)
84 ;"x2inputs(Options,Results,Modal)
85 ;"x3inputs(Options,Results,Modal)
86 ;"xcombo(Options,Results,Modal)
87 ;"xrange(Options,Results,Modal)
88 ;"x2range(Options,Results,Modal)
89 ;"x3range(Options,Results,Modal)
90 ;"xspin(Options,Results,Modal)
91 ;"x2spin(Options,Results,Modal)
92 ;"x3spin(Options,Results,Modal)
93 ;"xlog(Options,Results,Modal)
94 ;"xedit(Options,Results,Modal)
95 ;"xtext(Options,Results,Modal)
96 ;"xtail(Options,Results,Modal)
97 ;"xchecklist(Options,Results,Modal)
98 ;"xradiolist(Options,Results,Modal)
99 ;"xmenu(Options,Results,Modal)
100 ;"xtreeview(Options,Results,Modal)
101 ;"xfilesel(Options,Results,Modal)
102 ;"xdirsel(Options,Results,Modal)
103 ;"xcalendarsel(Options,Results,Modal)
104 ;"xtimesel(Options,Results,Modal)
105 ;"xbuildlist(Options,Results,Modal)
106 ;"xcolorsel(Options,Results,Modal)
107 ;"xfontsel(Options,Results,Modal)
108
109
110 ;"Expected format for Options:
111
112 ;"The documentation for these options may be found at:
113 ;"http://thgodef.nerim.net/xdialog/doc/index.html
114
115 ;"Options should be an array inthe following format:
116 ;"
117 ;" Options(xcCommon,xcWMClass)=<name>
118 ;" Options(xcCommon,xcRxcFile)=<gtkrc filename>
119 ;" Options(xcCommon,xcBackTitle)=<backtitle>
120 ;" Options(xcCommon,xcTitle"=<title>
121 ;" Options(xcCommon,xcAllowClose)=1 } A.
122 ;" Options(xcCommon,xcNoClose)=1 } B. A & B are opposites
123 ;" Options(xcCommon,xcScreenCenter)=1 } A.
124 ;" Options(xcCommon,xcUnderMouse)=1 } B.
125 ;" Options(xcCommon,xcAutoPlacement)=1 } C. A,B & C are mutually exclusive options
126 ;" Options(xcCommon,xcCenter)=1 } A.
127 ;" Options(xcCommon,xcRight)=1 } B.
128 ;" Options(xcCommon,xcLeft)=1 } C.
129 ;" Options(xcCommon,xcFill)=1 } D. A,B,C & D are mutually exclusive options
130 ;" Options(xcCommon,xcNoWrap)=1 } A
131 ;" Options(xcCommon,xcWrap)=1 } B A & B are opposites
132 ;" Options(xcCommon,xcCRWrap)=1 } A.
133 ;" Options(xcCommon,xcNoCRWrap)=1 } B. A & B are opposites
134 ;" Options(xcCommon,xcStdErr)=1 } A.
135 ;" Options(xcCommon,xcStdOut)=1 } B. A & B are opposites
136 ;" Options(xcCommon,xcSeparator)=<character> } A.
137 ;" Options(xcCommon,xcSeparateOutput)=1 } B. A & B are opposites.
138 ;" Options(xcCommon,xcButtonsStyle)="default" or "icon" or "text" (only one of these three values)
139 ;" Options(xcTransient,xcFixedFont)=1
140 ;" Options(xcTransient,xcPassword)=1
141 ;" Options(xcTransient,xcEditable)=1
142 ;" Options(xcTransient,xcTimeStamp)=1 } A.
143 ;" Options(xcTransient,xcDateStamp)=1 } B. A & B are mutually exclusive
144 ;" Options(xcTransient,xcReverse)=1
145 ;" Options(xcTransient,xcKeepColors)=1
146 ;" Options(xcTransient,xcInterval)=<timeout>
147 ;" Options(xcTransient,xcNotags)=1
148 ;" Options(xcTransient,xxcItemHelp)=1
149 ;" Options(xcTransient,xxcDefaultItem)=<tag>
150 ;" Options(xcTransient,xcIcon)=<xpm filename>
151 ;" Options(xcTransient,xcNook)=1
152 ;" Options(xcTransient,xcNoCancel)=1
153 ;" Options(xcTransient,xcNoButtons)=1
154 ;" Options(xcTransient,xxcDefaultNo)=1
155 ;" Options(xcTransient,xcWizard)=1
156 ;" Options(xcTransient,xcHelp)=<help>
157 ;" Options(xcTransient,xcPrint)=<printer>
158 ;" Options(xcTransient,xcCheck)=<label [<status>]>
159 ;" Options(xcTransient,xcOKLabel)=<label>
160 ;" Options(xcTransient,xcCancelLabel)=<label>
161 ;" Options(xcTransient,xcBeep)=1
162 ;" Options(xcTransient,xcBeepafter)=1
163 ;" Options(xcTransient,xcBegin)= <Yorg Xorg>
164 ;" Options(xcTransient,xcIgnoreEOF)=1
165 ;" Options(xcTransient,xcSmooth)=1
166 ;" Options(xcBox,xcText)=<value>
167 ;" Options(xcBox,xcHeight)=<value>
168 ;" Options(xcBox,xcWidth)=<value>
169 ;" Options(xcBox,xcTimeOut)=<value>
170 ;" Options(xcBox,xcPercent)=<value>
171 ;" Options(xcBox,xxcMaxDots)=<value>
172 ;" Options(xcBox,xcMsgLen)=<value>
173 ;" Options(xcBox,xcInit)=<value>
174 ;" Options(xcBox,xcLabel,N)=<value>
175 ;" Options(xcBox,xcInit,N)=<value>
176 ;" Options(xcBox,xcMin,N)=<value>
177 ;" Options(xcBox,xcMax,N)=<value>
178 ;" Options(xcBox,xcDefault,N)=<value
179 ;" Options(xcBox,xcFile)=<value>
180 ;" Options(xcBox,xcDirectory)=<value>
181 ;" Options(xcBox,xcFontName)=<value>
182 ;" Options(xcBox,xcDay)=<value>
183 ;" Options(xcBox,xcMonth)=<value>
184 ;" Options(xcBox,xcYear)=<value>
185 ;" Options(xcBox,xcHours)=<value>
186 ;" Options(xcBox,xcMinutes)=<value>
187 ;" Options(xcBox,xcSeconds)=<value>
188 ;" Options(xcBox,xcTag,N)=<value>
189 ;" Options(xcBox,xcItem,N)=<value>
190 ;" Options(xcBox,xcHelp,N)=<value>
191 ;" Options(xcBox,xcStatus,N)=<value> {"on", "off", or "unavailable"}
192 ;" Options(xcBox,xcListHeight)=<value>
193 ;" Options(xcBox,xcItemdepth,N)=<value>
194
195 ;"Notes:
196 ;" - Not all options will apply to all dialogs, but if the
197 ;" option is desired, it should be in the above format.
198 ;" - No syntax checking is performed. The options are simply
199 ;" passed to the Xdialog command in the proper order.
200 ;" - Everything below should be considered CASE-SENSITIVE.
201 ;" - Notice that the indexes used are constants (i.e. xcCommon)
202 ;" these are set up by SetupConsts(), and may later be killed
203 ;" via KillConsts(). Their use will avoid spelling errors
204 ;" resulting in a missed parameter.
205
206 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
207 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
208 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
209
210
211SetupConsts()
212 set vDialog="Xdialog"
213 set xcCommon="common"
214 set xcWMClass="wmclass"
215 set xcRxcFile="rxcFile"
216 set xcBackTitle="backtitle"
217 set xcTitle="title"
218 set xcAllowClose="allow-close"
219 set xcNoClose="no-close"
220 set xcScreenCenter="cscreen-center"
221 set xcUnderMouse="under-mouse"
222 set xcAutoPlacement="autoplacement"
223 set xcCenter="center"
224 set xcRight="right"
225 set xcLeft="left"
226 set xcFill="fill"
227 set xcNoWrap="no-wrap"
228 set xcWrap="wrap"
229 set xcCRWrap="cr-wrap"
230 set xcNoCRWrap="no-cr-wrap"
231 set xcStdErr="stderr"
232 set xcStdOut="stdout"
233 set xcSeparator="separator"
234 set xcSeparateOutput="separate-output"
235 set xcButtonsStyle="buttons-style"
236 set xcTransient="transient"
237 set xcFixedFont="fixed-font"
238 set xcPassword="password"
239 set xcEditable="editable"
240 set xcTimeStamp="time-stamp"
241 set xcDateStamp="date-stamp"
242 set xcReverse="reverse"
243 set xcKeepColors="keep-colors"
244 set xcInterval="interval"
245 set xcNotags="no-tags"
246 set xxcItemHelp="item-help"
247 set xxcDefaultItem="default-item"
248 set xcIcon="icon"
249 set xcNook="no-ok"
250 set xcNoCancel="no-cancel"
251 set xcNoButtons="no-buttons"
252 set xxcDefaultNo="default-no"
253 set xcWizard="wizard"
254 set xcHelp="help"
255 set xcPrint="print"
256 set xcCheck="check"
257 set xcOKLabel="ok-label"
258 set xcCancelLabel="cancel-label"
259 set xcBeep="beep"
260 set xcBeepafter="beep-after"
261 set xcBegin="begin"
262 set xcIgnoreEOF="ignore-eof"
263 set xcSmooth="smooth"
264 set xcBox="box"
265 set xcText="text"
266 set xcHeight="height"
267 set xcWidth="width"
268 set xcTimeOut="timeout"
269 set xcPercent="percent"
270 set xxcMaxDots="maxdots"
271 set xcMsgLen="msglen"
272 set xcInit="init"
273 set xcLabel="label"
274 set xcMin="min"
275 set xcMax="max"
276 set xcDefault="default"
277 set xcFile="file"
278 set xcDirectory="directory"
279 set xcFontName="font name"
280 set xcDay="day"
281 set xcMonth="month"
282 set xcYear="year"
283 set xcHours="hours"
284 set xcMinutes="minutes"
285 set xcSeconds="seconds"
286 set xcTag="tag"
287 set xcItem="item"
288 set xcHelp="help"
289 set xcStatus="status"
290 set xcListHeight="list height"
291 set xcItemdepth="item depth"
292 set xcCmdLine="command_line_params"
293 set xcCmdArray="Array"
294 set xcCmdMaxLine="Max_line"
295 set xcDlgResult="Dialog Result"
296 set xcDlgOutput="Dialog Output"
297 set xcModalMode=1
298 set xcNonModal=0
299 set xcOptional=1
300 set xcNotOptional=0
301 set xcAddQuote=1
302 set xcNoQuote=0
303 set mrYes=0
304 set mrOK=0
305 set mrNext=0
306 set mrNo=1
307 set mrCancel=1
308 set mrHelp=2
309 set mrPrev=3
310 set mrError=255
311 quit
312
313
314KillConstants()
315 kill vDialog
316 kill xcCommon
317 kill xcWMClass
318 kill xcRxcFile
319 kill xcBackTitle
320 kill xcTitle
321 kill xcAllowClose
322 kill xcNoClose
323 kill xcScreenCenter
324 kill xcUnderMouse
325 kill xcAutoPlacement
326 kill xcCenter
327 kill xcRight
328 kill xcLeft
329 kill xcFill
330 kill xcNoWrap
331 kill xcWrap
332 kill xcCRWrap
333 kill xcNoCRWrap
334 kill xcStdErr
335 kill xcStdOut
336 kill xcSeparator
337 kill xcSeparateOutput
338 kill xcButtonsStyle
339 kill xcTransient
340 kill xcFixedFont
341 kill xcPassword
342 kill xcEditable
343 kill xcTimeStamp
344 kill xcDateStamp
345 kill xcReverse
346 kill xcKeepColors
347 kill xcInterval
348 kill xcNotags
349 kill xxcItemHelp
350 kill xxcDefaultItem
351 kill xcIcon
352 kill xcNook
353 kill xcNoCancel
354 kill xcNoButtons
355 kill xxcDefaultNo
356 kill xcWizard
357 kill xcHelp
358 kill xcPrint
359 kill xcCheck
360 kill xcOKLabel
361 kill xcCancelLabel
362 kill xcBeep
363 kill xcBeepafter
364 kill xcBegin
365 kill xcIgnoreEOF
366 kill xcSmooth
367 kill xcBox
368 kill xcText
369 kill xcHeight
370 kill xcWidth
371 kill xcTimeOut
372 kill xcPercent
373 kill xxcMaxDots
374 kill xcMsgLen
375 kill xcLabel
376 kill xcInit
377 kill xcMin
378 kill xcMax
379 kill xcDefault
380 kill xcFile
381 kill xcDirectory
382 kill xcFontName
383 kill xcDay
384 kill xcMonth
385 kill xcYear
386 kill xcHours
387 kill xcMinutes
388 kill xcSeconds
389 kill xcTag
390 kill xcItem
391 kill xcHelp
392 kill xcStatus
393 kill xcListHeight
394 kill xcItemdepth
395 kill xcCmdLine
396 kill xcCmdMaxLine
397 kill xcCmdArray
398 kill xcDlgResult
399 kill xcModalMode
400 kill xcNonModal
401 kill xcOptional
402 kill xcNotOptional
403 kill xcAddQuote
404 kill xcNoQuote
405 kill xcDlgOutput
406 kill mrYes
407 kill mrOK
408 kill mrNo
409 kill mrAbort
410 kill mrCancel
411 kill mrNext
412 kill mrHelp
413 kill mrPrev
414 kill mrError
415
416 quit
417
418SetGUI(UseGUI)
419 ;"For those who do not have an X system (i.e. a graphic display for unix/linux)
420 ;" then there is a backup plan that can do most of these functions
421 ;" on a text display (cool, eh?)
422 ;"Input: UseGUI -- if 1 (the default), then the graphic method is used
423 ;" if 0, then the character (text drawing) based method is used
424
425 if $data(xcCommon)=0 do SetupConsts()
426
427 set UseGUI=$get(UseGUI,1)
428 if UseGUI=0 set vDialog="dialog"
429 else set vDialog="Xdialog"
430 quit
431
432 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
433
434YesNo(Text,width,height,x,y)
435 ;"Purpose: To provide an easier access to xyesnot
436 ;"Input: Text to display
437 ;" height & width of dialog -- [optional]
438 ;" x,y -- the display location of the dialog [optional]
439 ;"Output: (none)
440 ;"Results: returns results of box closure.
441 ;"Notes: (none)
442
443 new Options
444 new Results,result
445
446 if $data(xcCommon)=0 do SetupConsts()
447
448 set Options(xcBox,xcText)=Text
449 set Options(xcBox,xcHeight)=$get(height,0)
450 set Options(xcBox,xcWidth)=$get(width,0)
451 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
452
453 do xyesno(.Options,.Results,xcModalMode) ;"Force won't return until dialog closed.
454 set result=Results(xcDlgResult)
455
456 quit result;
457
458
459xyesno(Options,Results,Modal)
460 ;" --yesno <text> <height> <width>
461 new Added
462
463 do ParamTextAdd(.Options,vDialog)
464 do SetCommons(.Options)
465 do SetTrans(.Options)
466 do ParamTextAdd(.Options," --yesno ")
467
468 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
469 set Added=$$AddParam(.Options,,xcHeight)
470 set Added=$$AddParam(.Options,,xcWidth)
471
472 do LaunchCmd(.Options,.Results,.Modal)
473
474 quit
475
476 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
477
478Msg(Title,Text,width,height,Modal,x,y)
479 ;"Purpose: To provide an easier access to Xdialog function
480 ;"Input: Text to display
481 ;" height & width of dialog -- [optional]
482 ;" x,y -- the display location of the dialog [optional]
483 ;" Modal: if true, function does not return until dialog is closed.
484 ;" if false, function returns immediately, and functions do NOT
485 ;" reflect the user's button press.
486 ;"Output: (none)
487 ;"Results: Returns results of box closure (see Modal note above)
488 ;"Notes: (none)
489
490 new Options
491 new Results,result
492
493 if $data(xcCommon)=0 do SetupConsts()
494 if $data(Title) set Options(xcCommon,xcTitle)=Title
495 set Options(xcBox,xcText)=Text
496 set Options(xcBox,xcHeight)=$get(height,0)
497 set Options(xcBox,xcWidth)=$get(width,0)
498 set Modal=$get(Modal,xcNonModal)
499 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
500
501 do xmsg(.Options,.Results,Modal)
502 set result=Results(xcDlgResult)
503
504 quit result;
505
506
507xmsg(Options,Results,Modal)
508 ;" --msgbox <text> <height> <width>
509 new Added
510
511 do ParamTextAdd(.Options,vDialog)
512 do SetCommons(.Options)
513 do SetTrans(.Options)
514 do ParamTextAdd(.Options," --msgbox ")
515
516 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
517 set Added=$$AddParam(.Options,,xcHeight)
518 set Added=$$AddParam(.Options,,xcWidth)
519
520 do LaunchCmd(.Options,.Results,.Modal)
521
522 quit
523
524 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
525
526Info(Text,width,height,timeout,Modal,x,y)
527 ;"Purpose: To provide an easier access to Xdialog function
528 ;"Input: Text to display
529 ;" height & width of dialog -- [optional]
530 ;" [timeout]: time (in sec) delay until box automatically closes.
531 ;" OPTIONAL--default=1
532 ;" [Modal]: if true, function does not return until dialog is closed.
533 ;" if false, function returns immediately, and functions do NOT
534 ;" reflect the user's button press. OPTIONAL -- default=xcNonModal
535 ;" x,y -- the display location of the dialog [optional]
536 ;"Output: (none)
537 ;"Results: Returns results of box closure (see Modal note above)
538 ;"Notes: (none)
539
540 new Options
541 new Results,result
542
543 if $data(xcCommon)=0 do SetupConsts()
544
545 set Options(xcBox,xcText)=Text
546 set Options(xcBox,xcHeight)=$get(height,0)
547 set Options(xcBox,xcWidth)=$get(width,0)
548 set Modal=$get(Modal,xcNonModal)
549 if $data(timeout) set Options(xcBox,xcTimeOut)=timeout*1000
550 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
551
552 do xinfo(.Options,.Results,Modal)
553 set result=Results(xcDlgResult)
554
555 quit result;
556
557
558xinfo(Options,Results,Modal)
559 ;" --infobox <text> <height> <width> [<timeout>]
560 new Added
561
562 do ParamTextAdd(.Options,vDialog)
563 do SetCommons(.Options)
564 do SetTrans(.Options)
565 do ParamTextAdd(.Options," --infobox ")
566
567 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
568 set Added=$$AddParam(.Options,,xcHeight)
569 set Added=$$AddParam(.Options,,xcWidth)
570 set Added=$$AddParam(.Options,,xcTimeOut,1)
571
572 do LaunchCmd(.Options,.Results,.Modal)
573
574 quit
575
576 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
577 ;"NOT WORKING -- SEE NOTES ON GuageUpdate below...
578
579Guage(Text,width,height,Percent,x,y)
580 ;"Purpose: To provide an easier access to Xdialog function
581 ;" This is called to first display a guage dialog.
582 ;"Input: Text to display
583 ;" height & width of dialog -- [optional]
584 ;" x,y -- the display location of the dialog [optional]
585 ;" Percent -- Percentage of progress bar to show
586 ;"Output: (none)
587 ;"Results: Returns a handle that is used in GuageUpdate
588 ;"Notes: Box is left open unless Percent is > 100%
589 ;"NOTICE: This function is not working.
590 new Options
591 new Results,result
592
593 if $data(xcCommon)=0 do SetupConsts()
594
595 set Options(xcBox,xcText)=$get(Text)
596 set Options(xcBox,xcHeight)=$get(height,0)
597 set Options(xcBox,xcWidth)=$get(width,0)
598 set Options(xcBox,xcPercent)=$get(Percent,0)
599 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
600
601 do xguage(.Options,.Results,xcNonModal) ;"note: Xdialog will show box as non-modal regardless (I think)
602 set result=$get(Text)_"^"_$get(height)_"^"_$get(width) ;"This will be used as a handle.
603
604 quit result;
605
606GuageUpdate(Handle,Percent)
607 ;"Purpose: To provide an easier access to Xdialog function
608 ;" This is called to update the percentage on an existing form.
609 ;"Input: Handle -- the handle returned from original call to Guage
610 ;" Percent -- Percentage of progress bar to show
611 ;"Output: (none)
612 ;"Results: 'StillActive' i.e. 1: box still open. 0:box closed
613 ;"Notes: Box is left open unless Percent is > 100%
614 ;"NOTICE: This function is not working. To update a guage, the dialog is setup to accept new values
615 ;" on stdin. I'm not sure how to do this from inside M....
616 ;" Perhaps I could redirect stdin to a file, then write values out to that file...
617 ;" However, when EOF is reached, then box is closed....
618
619 new Text
620 new height
621 new width
622 set Handle=$get(Handle)
623 set Percent=$get(Percent)
624
625 set Text=$piece(Handle,"^",1)
626 set height=$piece(Handle,"^",2)
627 set width=$piece(Handle,"^",3)
628
629 new dump
630 set dump=$$Guage(Text,width,height,Percent)
631
632 quit '(Percent>100)
633
634
635xguage(Options,Results,Modal)
636 ;" --gauge <text> <height> <width> [<percent>]
637 new Added
638
639 do ParamTextAdd(.Options,vDialog)
640 do SetCommons(.Options)
641 do SetTrans(.Options)
642 do ParamTextAdd(.Options," --gauge ")
643
644 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
645 set Added=$$AddParam(.Options,,xcHeight)
646 set Added=$$AddParam(.Options,,xcWidth)
647 set Added=$$AddParam(.Options,,xcPercent)
648
649 do LaunchCmd(.Options,.Results,.Modal)
650
651 quit
652
653 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
654 ;"TO BE COMPLETED
655 ;"Note: I will have the same problems with this function as I did with Guage...
656 ;" So for now, I WON'T IMPLEMENT THIS...
657
658xprogress(Options,Results,Modal)
659 ;"Purpose:
660 ;"Input:
661 ;"Output:
662 ;"Results:
663 ;"Notes:
664 ;" --progress <text> <height> <width> [<maxdots> [[-]<msglen>]]
665
666 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
667Input(Title,width,height,InitText,Result,x,y)
668 ;"Purpose: To provide an easier access to Xdialog function
669 ;"Input: Title -- text of input prompt to display
670 ;" height & width of dialog -- [optional]
671 ;" InitText -- default value [optional]
672 ;" Result -- a variable to put input into for return. PASS BY REFERENCE
673 ;" x,y -- the display location of the dialog [optional]
674 ;"Output: The user input value is return in Result
675 ;"Results: returns results of box closure.
676 ;"Notes: (none)
677
678 new Options
679 new Results,result
680
681 if $data(xcCommon)=0 do SetupConsts()
682
683 set Options(xcBox,xcText)=$get(Title)
684 set Options(xcBox,xcHeight)=$get(height,0)
685 set Options(xcBox,xcWidth)=$get(width,0)
686 if $data(InitText) set Options(xcBox,xcInit)=InitText
687 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
688
689 do xinput(.Options,.Results,xcModalMode)
690 set result=Results(xcDlgResult)
691
692 ;"zwr Results(*)
693
694 set Result=$get(Results(xcDlgOutput,""))
695
696 quit result;
697
698xinput(Options,Results,Modal)
699 ;" --inputbox <text> <height> <width> [<init>]
700
701 new Added
702
703 do ParamTextAdd(.Options,vDialog)
704 do SetCommons(.Options)
705 do SetTrans(.Options)
706 do ParamTextAdd(.Options," --inputbox ")
707
708 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
709 set Added=$$AddParam(.Options,,xcHeight)
710 set Added=$$AddParam(.Options,,xcWidth)
711 set Added=$$AddParam(.Options,,xcInit)
712
713 do LaunchCmd(.Options,.Results,.Modal)
714
715 quit
716 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
717Input2(Title,width,height,Label1,Init1Text,Label2,Init2Text,Result1,Result2,x,y)
718 ;"Purpose: To provide an easier access to Xdialog function
719 ;"Input: Title -- text of input prompt to display
720 ;" height & width of dialog -- [optional]
721 ;" Label1 -- text of label for input 1 [optional]
722 ;" Init1Text -- default value [optional]
723 ;" Label2 -- text of label for input 2 [optional]
724 ;" Init2Text -- default value [optional]
725 ;" Result1 -- a variable to put first input into for return. PASS BY REFERENCE
726 ;" Result2 -- a variable to put second input into for return. PASS BY REFERENCE
727 ;" x,y -- the display location of the dialog [optional]
728 ;"Output: The user input value is return in Result1
729 ;" result of 2nd user-input put into Result2
730 ;"Results: returns results of box closure.
731 ;"Notes: (none)
732
733 new Options
734 new Results,result
735
736 if $data(xcCommon)=0 do SetupConsts()
737
738 set Options(xcCommon,xcSeparator)="^"
739 set Options(xcBox,xcText)=$get(Title)
740 set Options(xcBox,xcHeight)=$get(height,0)
741 set Options(xcBox,xcWidth)=$get(width,0)
742 set Options(xcBox,xcLabel,1)=$get(Label1," ")
743 set Options(xcBox,xcInit,1)=$get(Init1Text," ")
744 set Options(xcBox,xcLabel,2)=$get(Label2," ")
745 set Options(xcBox,xcInit,2)=$get(Init2Text," ")
746 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
747
748 do x2inputs(.Options,.Results,xcModalMode)
749 set result=Results(xcDlgResult)
750
751 set Result1=$get(Results(xcDlgOutput,""))
752 set Result2=$get(Results(xcDlgOutput,1))
753
754 quit result;
755
756
757x2inputs(Options,Results,Modal)
758 ;" --2inputsbox <text> <height> <width> <label1> <init1> <label2> <init2>
759 new Added
760
761 do ParamTextAdd(.Options,vDialog)
762 do SetCommons(.Options)
763 do SetTrans(.Options)
764 do ParamTextAdd(.Options," --2inputsbox ")
765
766 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
767 set Added=$$AddParam(.Options,,xcHeight)
768 set Added=$$AddParam(.Options,,xcWidth)
769 set Added=$$AddParam(.Options,1,xcLabel,xcNotOptional,xcAddQuote)
770 set Added=$$AddParam(.Options,1,xcInit,xcNotOptional,xcAddQuote)
771 set Added=$$AddParam(.Options,2,xcLabel,xcNotOptional,xcAddQuote)
772 set Added=$$AddParam(.Options,2,xcInit,xcNotOptional,xcAddQuote)
773
774 do LaunchCmd(.Options,.Results,.Modal)
775
776 quit
777
778 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
779Input3(Title,width,height,Label1,Init1Text,Label2,Init2Text,Label3,Init3Text,Result1,Result2,Result3,x,y)
780 ;"Purpose: To provide an easier access to Xdialog function
781 ;"Input: Title -- text of input prompt to display
782 ;" height & width of dialog -- [optional]
783 ;" Label1 -- text of label for input 1
784 ;" Init1Text -- default value
785 ;" Label2 -- text of label for input 2
786 ;" Init2Text -- default value
787 ;" Label3 -- text of label for input 3
788 ;" Init3Text -- default value
789 ;" Result1 -- a variable to put first input into for return. PASS BY REFERENCE
790 ;" Result2 -- a variable to put second input into for return. PASS BY REFERENCE
791 ;" Result3 -- a variable to put third input into for return. PASS BY REFERENCE
792 ;" x,y -- the display location of the dialog [optional]
793 ;"Output: The user input value is return in Result1
794 ;" result of 2nd user-input put into Result2
795 ;" result of 3rd user-input put into Result3
796 ;"Results: returns results of box closure.
797 ;"Notes: (none)
798
799 new Options
800 new Results,result
801
802 if $data(xcCommon)=0 do SetupConsts()
803
804 set Options(xcCommon,xcSeparator)="^"
805 set Options(xcBox,xcText)=$get(Title)
806 set Options(xcBox,xcHeight)=$get(height,0)
807 set Options(xcBox,xcWidth)=$get(width,0)
808 set Options(xcBox,xcLabel,1)=$get(Label1," ")
809 set Options(xcBox,xcInit,1)=$get(Init1Text," ")
810 set Options(xcBox,xcLabel,2)=$get(Label2," ")
811 set Options(xcBox,xcInit,2)=$get(Init2Text," ")
812 set Options(xcBox,xcLabel,3)=$get(Label3," ")
813 set Options(xcBox,xcInit,3)=$get(Init3Text," ")
814 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
815
816 do x3inputs(.Options,.Results,xcModalMode)
817 set result=Results(xcDlgResult)
818
819 set result=$get(Results(xcDlgOutput,""))
820 set Result2=$get(Results(xcDlgOutput,1))
821 set Result3=$get(Results(xcDlgOutput,2))
822
823 quit result;
824
825
826x3inputs(Options,Results,Modal)
827 ;" --3inputsbox <text> <height> <width> <label1> <init1> <label2> <init2> <label3> <init3>
828 new Added
829
830 do ParamTextAdd(.Options,vDialog)
831 do SetCommons(.Options)
832 do SetTrans(.Options)
833 do ParamTextAdd(.Options," --3inputsbox ")
834
835 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
836 set Added=$$AddParam(.Options,,xcHeight)
837 set Added=$$AddParam(.Options,,xcWidth)
838 set Added=$$AddParam(.Options,1,xcLabel,xcNotOptional,xcAddQuote)
839 set Added=$$AddParam(.Options,1,xcInit,xcNotOptional,xcAddQuote)
840 set Added=$$AddParam(.Options,2,xcLabel,xcNotOptional,xcAddQuote)
841 set Added=$$AddParam(.Options,2,xcInit,xcNotOptional,xcAddQuote)
842 set Added=$$AddParam(.Options,3,xcLabel,xcNotOptional,xcAddQuote)
843 set Added=$$AddParam(.Options,3,xcInit,xcNotOptional,xcAddQuote)
844
845 do LaunchCmd(.Options,.Results,.Modal)
846
847 quit
848
849 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
850Combo(Text,width,height,List,x,y)
851 ;"Purpose: To provide an easier access to Xdialog function
852 ;"Input: Text -- text of input prompt to display
853 ;" width,height of dialog -- [optional]
854 ;" List -- Best if passed by reference. Holds list of options to be displayed as follows:
855 ;" List(1)=<Selection Option>
856 ;" List(2)=<Selection Option>
857 ;" List(3)=<Selection Option>
858 ;" ... etc up to any number N
859 ;" x,y -- the display location of the dialog [optional]
860 ;"Output: (none)
861 ;"Results: Returns text of selected option.
862 ;"Notes: (none)
863
864 new Options
865 new Results
866 set result=""
867 new i,Done
868 new status,help
869
870 if $data(xcCommon)=0 do SetupConsts()
871
872 set Options(xcBox,xcText)=$get(Text)
873
874 set Done=0
875 for i=1:1 do quit:Done
876 . if $data(List(i))=0 set Done=1 quit
877 . set Options(xcBox,xcItem,i)=$get(List(i))
878
879 set Options(xcBox,xcHeight)=$get(height,0)
880 set Options(xcBox,xcWidth)=$get(width,0)
881 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
882
883 do xcombo(.Options,.Results,xcModalMode)
884
885 set result=$get(Results(xcDlgOutput,""))
886 quit result;
887
888
889xcombo(Options,Results,Modal)
890 ;" --combobox <text> <height> <width> <item1> ... <itemN>
891 new Added,GroupAdded
892 new N
893
894 do ParamTextAdd(.Options,vDialog)
895 do SetCommons(.Options)
896 do SetTrans(.Options)
897 do ParamTextAdd(.Options," --combobox ")
898
899 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
900 set Added=$$AddParam(.Options,,xcHeight)
901 set Added=$$AddParam(.Options,,xcWidth)
902 set N=1
903xcl1 if $data(Options(xcBox,xcItem,N))=0 goto xcl2
904 set GroupAdded=$$AddParam(.Options,N,xcItem,xcNotOptional,xcAddQuote)
905 if GroupAdded=0 goto xcl2
906 set N=N+1 goto xcl1
907xcl2
908 do LaunchCmd(.Options,.Results,.Modal)
909
910 quit
911
912
913 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
914Range(Text,width,height,min,max,init,x,y)
915 ;"Purpose: To provide an easier access to Xdialog function
916 ;" A range dialog presents a horizontal slider bar to user
917 ;"Input: Text -- text of input prompt to display
918 ;" width,height of dialog -- [optional]
919 ;" min -- the minimum possible range of input value (default = 0)
920 ;" max -- the minimum possible range of input value (default = 100)
921 ;" init -- the initial input value -- (default = 50)
922 ;" x,y -- the display location of the dialog [optional]
923 ;"Output: (none)
924 ;"Results: Returns input value
925 ;"Notes: (none)
926
927 new Options
928 new Results,result
929
930 if $data(xcCommon)=0 do SetupConsts()
931
932 set Options(xcBox,xcText)=$get(Text)
933 set Options(xcBox,xcHeight)=$get(height,0)
934 set Options(xcBox,xcWidth)=$get(width,0)
935 set Options(xcBox,xcMin,1)=$get(min,0)
936 set Options(xcBox,xcMax,1)=$get(max,100)
937 set Options(xcBox,xcDefault,1)=$get(init,50)
938 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
939
940 do xrange(.Options,.Results,xcModalMode)
941
942 set result=$get(Results(xcDlgOutput,""))
943
944 quit result;
945
946
947xrange(Options,Results,Modal)
948 ;" --rangebox <text> <height> <width> <min value> <max value> [<default value>]
949 new Added
950
951 do ParamTextAdd(.Options,vDialog)
952 do SetCommons(.Options)
953 do SetTrans(.Options)
954 do ParamTextAdd(.Options," --rangebox ")
955
956 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
957 set Added=$$AddParam(.Options,,xcHeight)
958 set Added=$$AddParam(.Options,,xcWidth)
959 set Added=$$AddParam(.Options,1,xcMin,xcNotOptional)
960 set Added=$$AddParam(.Options,1,xcMax,xcNotOptional)
961 set Added=$$AddParam(.Options,1,xcDefault,xcOptional)
962
963 do LaunchCmd(.Options,.Results,.Modal)
964
965 quit
966
967
968 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
969Range2(Text,width,height,label1,min1,max1,init1,label2,min2,max2,init2,Result2,x,y)
970 ;"Purpose: To provide an easier access to Xdialog function
971 ;"Input: Text -- text of input prompt to display
972 ;" width,height of dialog -- [optional]
973 ;" label1 -- the label to show for range
974 ;" min1 -- the minimum possible range of input value (default = 0)
975 ;" max1 -- the minimum possible range of input value (default = 100)
976 ;" init1 -- the initial input value -- (default = 50)
977 ;" label2 -- the label to show for range
978 ;" min2 -- the minimum possible range of input value (default = 0)
979 ;" max2 -- the minimum possible range of input value (default = 100)
980 ;" init2 -- the initial input value -- (default = 50)
981 ;" Result2 -- a variable to put second input into for return. PASS BY REFERENCE
982 ;" x,y -- the display location of the dialog [optional]
983 ;"Output: (none)
984 ;"Results: returns result of 1st user-input. result of 2nd user-input put into Result2
985 ;"Notes: (none)
986
987 new Options
988 new Results,result
989
990 if $data(xcCommon)=0 do SetupConsts()
991
992 set Options(xcCommon,xcSeparator)="^"
993 set Options(xcBox,xcText)=$get(Text)
994 set Options(xcBox,xcHeight)=$get(height,0)
995 set Options(xcBox,xcWidth)=$get(width,0)
996 set Options(xcBox,xcLabel,1)=$get(label1,"")
997 set Options(xcBox,xcMin,1)=$get(min1,0)
998 set Options(xcBox,xcMax,1)=$get(max1,100)
999 set Options(xcBox,xcMax,1)=$get(max1,100)
1000 set Options(xcBox,xcDefault,1)=$get(init1,50)
1001 set Options(xcBox,xcLabel,2)=$get(label2,"")
1002 set Options(xcBox,xcMin,2)=$get(min2,0)
1003 set Options(xcBox,xcMax,2)=$get(max2,100)
1004 set Options(xcBox,xcMax,2)=$get(max2,100)
1005 set Options(xcBox,xcDefault,2)=$get(init2,50)
1006 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1007
1008 do x2range(.Options,.Results,xcModalMode)
1009
1010 set result=$get(Results(xcDlgOutput,""))
1011 set Result2=$get(Results(xcDlgOutput,1))
1012
1013 quit result;
1014
1015
1016x2range(Options,Results,Modal)
1017 ;" --2rangesbox <text> <height> <width> <label1> <min1> <max1> <def1> <label2> <min2> <max2> <def2>
1018 new Added
1019
1020 do ParamTextAdd(.Options,vDialog)
1021 do SetCommons(.Options)
1022 do SetTrans(.Options)
1023 do ParamTextAdd(.Options," --2rangesbox ")
1024
1025 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
1026 set Added=$$AddParam(.Options,,xcHeight)
1027 set Added=$$AddParam(.Options,,xcWidth)
1028 set Added=$$AddParam(.Options,1,xcLabel,xcNotOptional,xcAddQuote)
1029 set Added=$$AddParam(.Options,1,xcMin,xcNotOptional)
1030 set Added=$$AddParam(.Options,1,xcMax,xcNotOptional)
1031 set Added=$$AddParam(.Options,1,xcDefault,xcNotOptional)
1032 set Added=$$AddParam(.Options,2,xcLabel,xcNotOptional,xcAddQuote)
1033 set Added=$$AddParam(.Options,2,xcMin,xcNotOptional)
1034 set Added=$$AddParam(.Options,2,xcMax,xcNotOptional)
1035 set Added=$$AddParam(.Options,2,xcDefault,xcNotOptional)
1036
1037 do LaunchCmd(.Options,.Results,.Modal)
1038
1039 quit
1040
1041 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1042Range3(Text,width,height,label1,min1,max1,init1,label2,min2,max2,init2,label3,min3,max3,init3,Result2,Result3,x,y)
1043 ;"Purpose: To provide an easier access to Xdialog function
1044 ;"Input: Text -- text of input prompt to display
1045 ;" width,height of dialog -- [optional]
1046 ;" labelN -- the title to show for the range.
1047 ;" minN -- the minimum possible range of input value (default = 0)
1048 ;" maxN -- the minimum possible range of input value (default = 100)
1049 ;" initN -- the initial input value -- (default = 50)
1050 ;" Result2 -- a variable to put second input into for return. PASS BY REFERENCE
1051 ;" Result3 -- a variable to put third input into for return. PASS BY REFERENCE
1052 ;" x,y -- the display location of the dialog [optional]
1053 ;"Output: (none)
1054 ;"Results: returns result of 1st user-input.
1055 ;" result of 2nd user-input put into Result2
1056 ;" result of 3rd user-input put into Result3
1057 ;"Notes: (none)
1058
1059 new Options
1060 new Results,result
1061
1062 if $data(xcCommon)=0 do SetupConsts()
1063
1064 set Options(xcCommon,xcSeparator)="^"
1065 set Options(xcBox,xcText)=$get(Text)
1066 set Options(xcBox,xcHeight)=$get(height,0)
1067 set Options(xcBox,xcWidth)=$get(width,0)
1068 set Options(xcBox,xcLabel,1)=$get(label1,"")
1069 set Options(xcBox,xcMin,1)=$get(min1,0)
1070 set Options(xcBox,xcMax,1)=$get(max1,100)
1071 set Options(xcBox,xcMax,1)=$get(max1,100)
1072 set Options(xcBox,xcDefault,1)=$get(init1,50)
1073 set Options(xcBox,xcLabel,2)=$get(label2,"")
1074 set Options(xcBox,xcMin,2)=$get(min2,0)
1075 set Options(xcBox,xcMax,2)=$get(max2,100)
1076 set Options(xcBox,xcMax,2)=$get(max2,100)
1077 set Options(xcBox,xcDefault,2)=$get(init2,50)
1078 set Options(xcBox,xcLabel,3)=$get(label3,"")
1079 set Options(xcBox,xcMin,3)=$get(min3,0)
1080 set Options(xcBox,xcMax,3)=$get(max3,100)
1081 set Options(xcBox,xcMax,3)=$get(max3,100)
1082 set Options(xcBox,xcDefault,3)=$get(init3,50)
1083 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1084
1085 do x3range(.Options,.Results,xcModalMode)
1086
1087 set result=$get(Results(xcDlgOutput,""))
1088 set Result2=$get(Results(xcDlgOutput,1))
1089 set Result3=$get(Results(xcDlgOutput,2))
1090
1091 quit result;
1092
1093
1094x3range(Options,Results,Modal)
1095 ;" --3rangesbox <text> <height> <width> <label1> <min1> <max1> <def1> <label2> <min2> <max2> <def2> <label3> <min3> <max3> <def3>
1096 new Added
1097
1098 do ParamTextAdd(.Options,vDialog)
1099 do SetCommons(.Options)
1100 do SetTrans(.Options)
1101 do ParamTextAdd(.Options," --3rangesbox ")
1102
1103 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
1104 set Added=$$AddParam(.Options,,xcHeight)
1105 set Added=$$AddParam(.Options,,xcWidth)
1106 set Added=$$AddParam(.Options,1,xcLabel,xcNotOptional,xcAddQuote)
1107 set Added=$$AddParam(.Options,1,xcMin,xcNotOptional)
1108 set Added=$$AddParam(.Options,1,xcMax,xcNotOptional)
1109 set Added=$$AddParam(.Options,1,xcDefault,xcNotOptional)
1110 set Added=$$AddParam(.Options,2,xcLabel,xcNotOptional,xcAddQuote)
1111 set Added=$$AddParam(.Options,2,xcMin,xcNotOptional)
1112 set Added=$$AddParam(.Options,2,xcMax,xcNotOptional)
1113 set Added=$$AddParam(.Options,2,xcDefault,xcNotOptional)
1114 set Added=$$AddParam(.Options,3,xcLabel,xcNotOptional,xcAddQuote)
1115 set Added=$$AddParam(.Options,3,xcMin,xcNotOptional)
1116 set Added=$$AddParam(.Options,3,xcMax,xcNotOptional)
1117 set Added=$$AddParam(.Options,3,xcDefault,xcNotOptional)
1118
1119 do LaunchCmd(.Options,.Results,.Modal)
1120
1121 quit
1122
1123
1124 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1125Spin(Text,width,height,label,min,max,init,Result,x,y)
1126 ;"Purpose: To provide an easier access to Xdialog function
1127 ;" A spinner is a dialable number input dialog.
1128 ;"Input: Text -- text of input prompt to display
1129 ;" width,height of dialog -- [optional]
1130 ;" min -- the minimum possible range of input value (default = 0)
1131 ;" max -- the minimum possible range of input value (default = 100)
1132 ;" init -- the initial input value -- (default = 50)
1133 ;" x,y -- the display location of the dialog [optional]
1134 ;"Output: The user input value is return in Result
1135 ;"Results: returns results of box closure.
1136 ;"Notes: (none)
1137
1138 new Options
1139 new Results,result
1140
1141 if $data(xcCommon)=0 do SetupConsts()
1142
1143 set Options(xcBox,xcText)=$get(Text)
1144 set Options(xcBox,xcHeight)=$get(height,0)
1145 set Options(xcBox,xcWidth)=$get(width,0)
1146 set Options(xcBox,xcMin,1)=$get(min,0)
1147 set Options(xcBox,xcMax,1)=$get(max,100)
1148 set Options(xcBox,xcMax,1)=$get(max,100)
1149 set Options(xcBox,xcLabel,1)=$get(label,"")
1150 set Options(xcBox,xcDefault,1)=$get(init,50)
1151 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1152
1153 do xspin(.Options,.Results,xcModalMode)
1154 set result=Results(xcDlgResult)
1155
1156 set Result=$get(Results(xcDlgOutput,""))
1157
1158 quit result;
1159
1160
1161xspin(Options,Results,Modal)
1162 ;" --spinbox <text> <height> <width> <min> <max> <def> <label>
1163 new Added
1164
1165 do ParamTextAdd(.Options,vDialog)
1166 do SetCommons(.Options)
1167 do SetTrans(.Options)
1168 do ParamTextAdd(.Options," --spinbox ")
1169
1170 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
1171 set Added=$$AddParam(.Options,,xcHeight)
1172 set Added=$$AddParam(.Options,,xcWidth)
1173 set Added=$$AddParam(.Options,1,xcMin,xcNotOptional)
1174 set Added=$$AddParam(.Options,1,xcMax,xcNotOptional)
1175 set Added=$$AddParam(.Options,1,xcDefault,xcOptional)
1176 set Added=$$AddParam(.Options,1,xcLabel,xcNotOptional,xcAddQuote)
1177
1178 do LaunchCmd(.Options,.Results,.Modal)
1179
1180 quit
1181
1182
1183 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1184Spin2(Text,width,height,label1,min1,max1,init1,label2,min2,max2,init2,Result1,Result2,x,y)
1185 ;"Purpose: To provide an easier access to Xdialog function
1186 ;"Input: Text -- text of input prompt to display
1187 ;" width,height of dialog -- [optional]
1188 ;" label1 -- the label to show for range
1189 ;" min1 -- the minimum possible range of input value (default = 0)
1190 ;" max1 -- the minimum possible range of input value (default = 100)
1191 ;" init1 -- the initial input value -- (default = 50)
1192 ;" label2 -- the label to show for range
1193 ;" min2 -- the minimum possible range of input value (default = 0)
1194 ;" max2 -- the minimum possible range of input value (default = 100)
1195 ;" init2 -- the initial input value -- (default = 50)
1196 ;" Result1 -- a variable to put first input into for return. PASS BY REFERENCE
1197 ;" Result2 -- a variable to put second input into for return. PASS BY REFERENCE
1198 ;" x,y -- the display location of the dialog [optional]
1199 ;"Output: The user input value is return in Result1
1200 ;" result of 2nd user-input put into Result2
1201 ;"Results: returns results of box closure.
1202 ;"Notes: (none)
1203 new Options
1204 new Results,result
1205
1206 if $data(xcCommon)=0 do SetupConsts()
1207
1208 set Options(xcCommon,xcSeparator)="^"
1209 set Options(xcBox,xcText)=$get(Text)
1210 set Options(xcBox,xcHeight)=$get(height,0)
1211 set Options(xcBox,xcWidth)=$get(width,0)
1212 set Options(xcBox,xcLabel,1)=$get(label1,"")
1213 set Options(xcBox,xcMin,1)=$get(min1,0)
1214 set Options(xcBox,xcMax,1)=$get(max1,100)
1215 set Options(xcBox,xcMax,1)=$get(max1,100)
1216 set Options(xcBox,xcDefault,1)=$get(init1,50)
1217 set Options(xcBox,xcLabel,2)=$get(label2,"")
1218 set Options(xcBox,xcMin,2)=$get(min2,0)
1219 set Options(xcBox,xcMax,2)=$get(max2,100)
1220 set Options(xcBox,xcMax,2)=$get(max2,100)
1221 set Options(xcBox,xcDefault,2)=$get(init2,50)
1222 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1223
1224 do x2spin(.Options,.Results,xcModalMode)
1225 set result=Results(xcDlgResult)
1226
1227 set Result1=$get(Results(xcDlgOutput,""))
1228 set Result2=$get(Results(xcDlgOutput,1))
1229
1230 quit result;
1231
1232
1233x2spin(Options,Results,Modal)
1234 ;" --2spinsbox <text> <height> <width> <min1> <max1> <def1> <label1> <min2> <max2> <def2> <label2>
1235 new Added
1236
1237 do ParamTextAdd(.Options,vDialog)
1238 do SetCommons(.Options)
1239 do SetTrans(.Options)
1240
1241 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
1242 set Added=$$AddParam(.Options,,xcHeight)
1243 set Added=$$AddParam(.Options,,xcWidth)
1244 set Added=$$AddParam(.Options,1,xcMin,xcNotOptional)
1245 set Added=$$AddParam(.Options,1,xcMax,xcNotOptional)
1246 set Added=$$AddParam(.Options,1,xcDefault,xcNotOptional)
1247 set Added=$$AddParam(.Options,1,xcLabel,xcNotOptional,xcAddQuote)
1248 set Added=$$AddParam(.Options,2,xcMin,xcNotOptional)
1249 set Added=$$AddParam(.Options,2,xcMax,xcNotOptional)
1250 set Added=$$AddParam(.Options,2,xcDefault,xcNotOptional)
1251 set Added=$$AddParam(.Options,2,xcLabel,xcNotOptional,xcAddQuote)
1252
1253 do LaunchCmd(.Options,.Results,.Modal)
1254
1255 quit
1256
1257
1258 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1259Spin3(Text,width,height,label1,min1,max1,init1,label2,min2,max2,init2,label3,min3,max3,init3,Result1,Result2,Result3,x,y)
1260 ;"Purpose: To provide an easier access to Xdialog function
1261 ;"Input: Text -- text of input prompt to display
1262 ;" width,height of dialog -- [optional]
1263 ;" labelN -- the title to show for the range.
1264 ;" minN -- the minimum possible range of input value (default = 0)
1265 ;" maxN -- the minimum possible range of input value (default = 100)
1266 ;" initN -- the initial input value -- (default = 50)
1267 ;" Result1 -- a variable to put first input into for return. PASS BY REFERENCE
1268 ;" Result2 -- a variable to put second input into for return. PASS BY REFERENCE
1269 ;" Result3 -- a variable to put third input into for return. PASS BY REFERENCE
1270 ;" x,y -- the display location of the dialog [optional]
1271 ;"Output: The user input value is return in Result1
1272 ;" result of 2nd user-input put into Result2
1273 ;" result of 3rd user-input put into Result3
1274 ;"Results: returns results of box closure.
1275 ;"Notes: (none)
1276
1277 new Options
1278 new Results,result
1279
1280 if $data(xcCommon)=0 do SetupConsts()
1281
1282 set Options(xcCommon,xcSeparator)="^"
1283 set Options(xcBox,xcText)=$get(Text)
1284 set Options(xcBox,xcHeight)=$get(height,0)
1285 set Options(xcBox,xcWidth)=$get(width,0)
1286 set Options(xcBox,xcLabel,1)=$get(label1,"")
1287 set Options(xcBox,xcMin,1)=$get(min1,0)
1288 set Options(xcBox,xcMax,1)=$get(max1,100)
1289 set Options(xcBox,xcMax,1)=$get(max1,100)
1290 set Options(xcBox,xcDefault,1)=$get(init1,50)
1291 set Options(xcBox,xcLabel,2)=$get(label2,"")
1292 set Options(xcBox,xcMin,2)=$get(min2,0)
1293 set Options(xcBox,xcMax,2)=$get(max2,100)
1294 set Options(xcBox,xcMax,2)=$get(max2,100)
1295 set Options(xcBox,xcDefault,2)=$get(init2,50)
1296 set Options(xcBox,xcLabel,3)=$get(label3,"")
1297 set Options(xcBox,xcMin,3)=$get(min3,0)
1298 set Options(xcBox,xcMax,3)=$get(max3,100)
1299 set Options(xcBox,xcMax,3)=$get(max3,100)
1300 set Options(xcBox,xcDefault,3)=$get(init3,50)
1301 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1302
1303 do x3spin(.Options,.Results,xcModalMode)
1304 set result=Results(xcDlgResult)
1305
1306 set Result1=$get(Results(xcDlgOutput,""))
1307 set Result2=$get(Results(xcDlgOutput,1))
1308 set Result3=$get(Results(xcDlgOutput,2))
1309
1310 quit result;
1311
1312
1313x3spin(Options,Results,Modal)
1314 ;" --3spinsbox <text> <height> <width> <text> <height> <width> <min1> <max1> <def1> <label1> <min2> <max2> <def2> <label2> <min3> <max3> <def3> <label3>
1315 new Added
1316
1317 do ParamTextAdd(.Options,vDialog)
1318 do SetCommons(.Options)
1319 do SetTrans(.Options)
1320 do ParamTextAdd(.Options," --2spinsbox ")
1321
1322 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
1323 set Added=$$AddParam(.Options,,xcHeight)
1324 set Added=$$AddParam(.Options,,xcWidth)
1325 set Added=$$AddParam(.Options,1,xcMin,xcNotOptional)
1326 set Added=$$AddParam(.Options,1,xcMax,xcNotOptional)
1327 set Added=$$AddParam(.Options,1,xcDefault,xcNotOptional)
1328 set Added=$$AddParam(.Options,1,xcLabel,xcNotOptional,xcAddQuote)
1329 set Added=$$AddParam(.Options,2,xcMin,xcNotOptional)
1330 set Added=$$AddParam(.Options,2,xcMax,xcNotOptional)
1331 set Added=$$AddParam(.Options,2,xcDefault,xcNotOptional)
1332 set Added=$$AddParam(.Options,2,xcLabel,xcNotOptional,xcAddQuote)
1333 set Added=$$AddParam(.Options,3,xcMin,xcNotOptional)
1334 set Added=$$AddParam(.Options,3,xcMax,xcNotOptional)
1335 set Added=$$AddParam(.Options,3,xcDefault,xcNotOptional)
1336 set Added=$$AddParam(.Options,3,xcLabel,xcNotOptional,xcAddQuote)
1337
1338 do LaunchCmd(.Options,.Results,.Modal)
1339
1340 quit
1341
1342
1343
1344 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1345
1346Log(file,width,height,Modal,x,y)
1347 ;"Purpose: To provide an easier access to Xdialog function
1348 ;"Input: file to display
1349 ;" height & width of dialog -- [optional]
1350 ;" [Modal]: if true, function does not return until dialog is closed.
1351 ;" if false, function returns immediately, and functions do NOT
1352 ;" reflect the user's button press. OPTIONAL -- default=xcNonModal
1353 ;" x,y -- the display location of the dialog [optional]
1354 ;"Output: (none)
1355 ;"Results: Returns results of box closure (see Modal note above)
1356 ;"Notes: (none)
1357
1358 new Options
1359 new Results,result
1360
1361 if $data(xcCommon)=0 do SetupConsts()
1362
1363 set Options(xcBox,xcFile)=$get(file)
1364 set Options(xcBox,xcHeight)=$get(height,0)
1365 set Options(xcBox,xcWidth)=$get(width,0)
1366 set Modal=$get(Modal,xcNonModal)
1367 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1368
1369 do xlog(.Options,.Results,Modal)
1370 set result=Results(xcDlgResult)
1371
1372 quit result;
1373
1374
1375xlog(Options,Results,Modal)
1376 ;" --logbox <file> <height> <width>
1377 new Added
1378
1379 do ParamTextAdd(.Options,vDialog)
1380 do SetCommons(.Options)
1381 do SetTrans(.Options)
1382 do ParamTextAdd(.Options," --logbox ")
1383
1384
1385 set Added=$$AddParam(.Options,,xcFile,xcNotOptional,xcAddQuote)
1386 set Added=$$AddParam(.Options,,xcHeight)
1387 set Added=$$AddParam(.Options,,xcWidth)
1388
1389 do LaunchCmd(.Options,.Results,.Modal)
1390
1391 quit
1392
1393 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1394
1395Edit(file,width,height,Results,x,y)
1396 ;"Purpose: To provide an easier access to Xdialog function
1397 ;"Input: file to display for editing,
1398 ;" height & width of dialog -- [optional]
1399 ;" Results -- the array to put results into. MUST BE PASSED BY REFERENCE.
1400 ;" x,y -- the display location of the dialog [optional]
1401 ;"Output: The modified text is put into Results
1402 ;" Example of returned results after editing a script file.:
1403 ;" Results("Dialog Output",1)="<!DOCTYPE INSTALL_SCRIPT>"
1404 ;" Results("Dialog Output",2)="<INSTALL_SCRIPT>"
1405 ;" Results("Dialog Output",3)="<Script>"
1406 ;" Results("Dialog Output",4)=" <Show>This is a test script system.</Show>"
1407 ;" Results("Dialog Output",5)="</Script>"
1408 ;"Results: Returns results of box closure (see Modal note above)
1409 ;"Notes: If dialog is not closed with an OK, then changes are NOT returned in Results
1410
1411 new Options
1412 new Results,result
1413
1414 if $data(xcCommon)=0 do SetupConsts()
1415
1416 set Options(xcBox,xcFile)=$get(file)
1417 set Options(xcBox,xcHeight)=$get(height,0)
1418 set Options(xcBox,xcWidth)=$get(width,0)
1419 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1420
1421 do xedit(.Options,.Results,xcModalMode)
1422 set result=Results(xcDlgResult)
1423
1424 quit result;
1425
1426
1427xedit(Options,Results,Modal)
1428 ;" --editbox <file> <height> <width>
1429 new Added
1430
1431 do ParamTextAdd(.Options,vDialog)
1432 do SetCommons(.Options)
1433 do SetTrans(.Options)
1434 do ParamTextAdd(.Options," --editbox ")
1435
1436 set Added=$$AddParam(.Options,,xcFile,xcNotOptional,xcAddQuote)
1437 set Added=$$AddParam(.Options,,xcHeight)
1438 set Added=$$AddParam(.Options,,xcWidth)
1439
1440 do LaunchCmd(.Options,.Results,.Modal)
1441
1442 quit
1443
1444 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1445
1446Text(file,width,height,Modal,x,y)
1447 ;"Purpose: To provide an easier access to Xdialog function
1448 ;"Input: file to display
1449 ;" height & width of dialog -- [optional]
1450 ;" [Modal]: if true, function does not return until dialog is closed.
1451 ;" if false, function returns immediately, and functions do NOT
1452 ;" reflect the user's button press. OPTIONAL -- default=xcNonModal
1453 ;" x,y -- the display location of the dialog [optional]
1454 ;"Output: (none)
1455 ;"Results: Returns results of box closure (see Modal note above)
1456 ;"Notes: (none)
1457
1458 new Options
1459 new Results,result
1460
1461 if $data(xcCommon)=0 do SetupConsts()
1462
1463 set Options(xcBox,xcFile)=$get(file)
1464 set Options(xcBox,xcHeight)=$get(height,0)
1465 set Options(xcBox,xcWidth)=$get(width,0)
1466 set Modal=$get(Modal,xcNonModal)
1467 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1468
1469 do xtext(.Options,.Results,Modal)
1470 set result=Results(xcDlgResult)
1471
1472 quit result;
1473
1474
1475xtext(Options,Results,Modal)
1476 ;" --textbox <file> <height> <width>
1477 new Added
1478
1479 do ParamTextAdd(.Options,vDialog)
1480 do SetCommons(.Options)
1481 do SetTrans(.Options)
1482 do ParamTextAdd(.Options," --textbox ")
1483
1484 set Added=$$AddParam(.Options,,xcFile,xcNotOptional,xcAddQuote)
1485 set Added=$$AddParam(.Options,,xcHeight)
1486 set Added=$$AddParam(.Options,,xcWidth)
1487
1488 do LaunchCmd(.Options,.Results,.Modal)
1489
1490 quit
1491
1492 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1493
1494Tail(file,width,height,Modal,x,y)
1495 ;"Purpose: To provide an easier access to Xdialog function
1496 ;" A tailbox is one that keeps at the bottom, updating as the file is updated.
1497 ;"Input: file to display
1498 ;" height & width of dialog -- [optional]
1499 ;" [Modal]: if true, function does not return until dialog is closed.
1500 ;" if false, function returns immediately, and functions do NOT
1501 ;" reflect the user's button press. OPTIONAL -- default=xcNonModal
1502 ;" x,y -- the display location of the dialog [optional]
1503 ;"Output: (none)
1504 ;"Results: Returns results of box closure (see Modal note above)
1505 ;"Notes: (none)
1506
1507 new Options
1508 new Results,result
1509
1510 if $data(xcCommon)=0 do SetupConsts()
1511
1512 set Options(xcBox,xcFile)=$get(file)
1513 set Options(xcBox,xcHeight)=$get(height,0)
1514 set Options(xcBox,xcWidth)=$get(width,0)
1515 set Modal=$get(Modal,xcNonModal)
1516 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1517
1518 do xtail(.Options,.Results,Modal)
1519 set result=Results(xcDlgResult)
1520
1521 quit result;
1522
1523
1524xtail(Options,Results,Modal)
1525 ;" --tailbox <file> <height> <width>
1526 new Added
1527
1528 do ParamTextAdd(.Options,vDialog)
1529 do SetCommons(.Options)
1530 do SetTrans(.Options)
1531 do ParamTextAdd(.Options," --tailbox ")
1532
1533 set Added=$$AddParam(.Options,,xcFile,xcNotOptional,xcAddQuote)
1534 set Added=$$AddParam(.Options,,xcHeight)
1535 set Added=$$AddParam(.Options,,xcWidth)
1536
1537 do LaunchCmd(.Options,.Results,.Modal)
1538
1539 quit
1540
1541 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1542 ;"TO BE COMPLETED
1543
1544xchecklist(Options,Results,Modal)
1545 ;" --checklist <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
1546
1547 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1548
1549RadioList(Text,List,width,height,x,y)
1550 ;"Purpose: To provide an easier access to Xdialog function
1551 ;" A tailbox is one that keeps at the bottom, updating as the file is updated.
1552 ;"Input: Text -- title text.
1553 ;" List -- Best if passed by reference. Holds radio list as follows:
1554 ;" List(1,xcTag)=<return value> -- the output the be returned if selected.
1555 ;" List(1,xcItem)=<text of radio item>
1556 ;" List(1,xcStatus)=<status> must be: {"on", "off", or "unavailable"}
1557 ;" List(1,xcHelp)=<hover tip> -- [optional]
1558 ;" List(2,xcTag)=<return value> -- the output the be returned if selected.
1559 ;" List(2,xcItem)=<text of radio item>
1560 ;" List(2,xcStatus)=<status> must be: {"on", "off", or "unavailable"}
1561 ;" List(2,xcHelp)=<hover tip> -- [optional]
1562 ;" ... etc up to any number N
1563 ;" height & width of dialog -- [optional]
1564 ;" x,y -- the display location of the dialog [optional]
1565 ;"Output: (none)
1566 ;"Results: Returns selected 'tag'. If cancel pressed, then returns ""
1567 ;"Notes: (none)
1568
1569 new Options
1570 new Results
1571 set result=""
1572 new i,Done
1573 new status,help
1574
1575 if $data(xcCommon)=0 do SetupConsts()
1576
1577 set Options(xcBox,xcText)=$get(Text)
1578
1579 set Done=0
1580 for i=1:1 do quit:Done
1581 . if $data(List(i,xcTag))=0 set Done=1 quit
1582 . set Options(xcBox,xcTag,i)=$get(List(i,xcTag))
1583 . set Options(xcBox,xcItem,i)=$get(List(i,xcItem))
1584 . set status=$get(List(i,xcStatus))
1585 . if (status'="on")&(status'="unavailable") set status="off"
1586 . set Options(xcBox,xcStatus,i)=status
1587 . set help=$get(List(i,xcHelp,i))
1588 . if help'="" set Options(xcTransient,xxcItemHelp)=1
1589 . set help=($get(Options(xcTransient,xxcItemHelp))=1)
1590 . if help set Options(xcBox,xcHelp,i)=$get(List(i,xcHelp))
1591
1592 set Options(xcBox,xcHeight)=$get(height,0)
1593 set Options(xcBox,xcWidth)=$get(width,0)
1594 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1595
1596 do xradiolist(.Options,.Results,xcModalMode)
1597
1598 set result=$get(Results(xcDlgOutput,""))
1599 quit result;
1600
1601
1602xradiolist(Options,Results,Modal)
1603 ;" --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
1604 new Added,GroupAdded
1605 new N
1606
1607 do ParamTextAdd(.Options,vDialog)
1608 do SetCommons(.Options)
1609 do SetTrans(.Options)
1610 do ParamTextAdd(.Options," --radiolist ")
1611
1612 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
1613 set Added=$$AddParam(.Options,,xcHeight)
1614 set Added=$$AddParam(.Options,,xcWidth)
1615 set Added=$$AddParam(.Options,,xcListHeight)
1616 set N=1
1617xrl1 set GroupAdded=$$AddParam(.Options,N,xcTag,xcNotOptional,xcAddQuote)
1618 if GroupAdded=0 goto xrl2
1619 set Added=$$AddParam(.Options,N,xcItem,xcNotOptional,xcAddQuote)
1620 set Added=$$AddParam(.Options,N,xcStatus,xcNotOptional,xcAddQuote)
1621 if (Added=1)&($get(Option(xcTransient,xxcItemHelp))=1) do
1622 . set Added=$$AddParam(.Options,N,xcHelp,xcNotOptional,xcAddQuote)
1623 set N=N+1 goto xrl1
1624xrl2
1625 do LaunchCmd(.Options,.Results,.Modal)
1626
1627 quit
1628
1629
1630 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1631 ;"TO BE COMPLETED
1632
1633xmenu(Options,Results,Modal)
1634 ;" --menubox <text> <height> <width> <menu height> <tag1> <item1> {<help1>}...
1635
1636 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1637 ;"TO BE COMPLETED
1638
1639xtreeview(Options,Results,Modal)
1640 ;" --treeview <text> <height> <width> <list height> <tag1> <item1> <status1> <item_depth1> {<help1>}...
1641
1642 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1643
1644FileSel(Title,InitFile,width,height,x,y)
1645 ;"Purpose: To provide an easier access to Xdialog function
1646 ;" A tailbox is one that keeps at the bottom, updating as the file is updated.
1647 ;"Input: InitFile. The initial file to select, and the default file. [optional]
1648 ;" width,height -- the initial size of box. [Optional]
1649 ;" x,y -- the display location of the dialog [optional]
1650 ;"Output:(none)
1651 ;"Results: returns the selected filename
1652 ;"Notes: (none)
1653
1654 new Options
1655 new Results
1656 new result set result=""
1657
1658 if $data(xcCommon)=0 do SetupConsts()
1659 if $data(Title) set Options(xcCommon,xcTitle)=Title
1660 set Options(xcBox,xcFile)=$get(InitFile,"")
1661 set Options(xcBox,xcHeight)=$get(height,0)
1662 set Options(xcBox,xcWidth)=$get(width,0)
1663 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1664
1665 do xfilesel(.Options,.Results,xcModalMode)
1666
1667 if Results(xcDlgResult)=0 set result=$get(Results(xcDlgOutput,""))
1668
1669 quit result;
1670
1671xfilesel(Options,Results,Modal)
1672 ;" --fselect <file> <height> <width>
1673 new Added
1674
1675 do ParamTextAdd(.Options,vDialog)
1676 do SetCommons(.Options)
1677 do SetTrans(.Options)
1678 do ParamTextAdd(.Options," --fselect ")
1679
1680 set Added=$$AddParam(.Options,,xcFile,xcNotOptional,xcAddQuote)
1681 set Added=$$AddParam(.Options,,xcHeight)
1682 set Added=$$AddParam(.Options,,xcWidth)
1683
1684 do LaunchCmd(.Options,.Results,.Modal)
1685
1686 quit
1687
1688 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1689
1690DirSel(Title,InitDir,width,height,x,y)
1691 ;"Purpose: To provide an easier access to Xdialog function
1692 ;" A tailbox is one that keeps at the bottom, updating as the file is updated.
1693 ;"Input: InitDir: The initial file to select, and the default file. [optional]
1694 ;" width,height -- the initial size of box. [Optional]
1695 ;" x,y -- the display location of the dialog [optional]
1696 ;"Output:(none)
1697 ;"Results: returns the selected directory
1698 ;"Notes: (none)
1699
1700 new Options
1701 new Results
1702 new result set result=""
1703
1704 if $data(xcCommon)=0 do SetupConsts()
1705 if $data(Title) set Options(xcCommon,xcTitle)=Title
1706 set Options(xcBox,xcDirectory)=$get(InitDir,"")
1707 set Options(xcBox,xcHeight)=$get(height,0)
1708 set Options(xcBox,xcWidth)=$get(width,0)
1709 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1710
1711 do xdirsel(.Options,.Results,xcModalMode)
1712
1713 if Results(xcDlgResult)=0 set result=$get(Results(xcDlgOutput,""))
1714
1715 quit result;
1716
1717
1718xdirsel(Options,Results,Modal)
1719 ;" --dselect <directory> <height> <width>
1720 new Added
1721
1722 do ParamTextAdd(.Options,vDialog)
1723 do SetCommons(.Options)
1724 do SetTrans(.Options)
1725 do ParamTextAdd(.Options," --dselect ")
1726
1727
1728 set Added=$$AddParam(.Options,,xcDirectory,xcNotOptional,xcAddQuote)
1729 set Added=$$AddParam(.Options,,xcHeight)
1730 set Added=$$AddParam(.Options,,xcWidth)
1731
1732 do LaunchCmd(.Options,.Results,.Modal)
1733
1734 quit
1735
1736 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1737
1738DateSel(Text,width,height,InitDay,InitMonth,InitYear,x,y)
1739 ;"Purpose: To provide an easier access to Xdialog function
1740 ;" Shows a calendar and allows user to select date.
1741 ;"Input: Text -- a title / msg to show.
1742 ;" width,height -- the initial size of box. [Optional]
1743 ;" InitDay/Month/Year -- Initial date to show.
1744 ;" NOTE: These three variables are optional BUT if InitDay given all 3 should be present.
1745 ;" x,y -- the display location of the dialog [optional]
1746 ;"Output:(none)
1747 ;"Results: returns the selected date
1748 ;"Notes: (none)
1749
1750 new Options
1751 new Results
1752 new result set result=""
1753
1754 if $data(xcCommon)=0 do SetupConsts()
1755
1756 set Options(xcBox,xcText)=$get(Text,"")
1757 set Options(xcBox,xcHeight)=$get(height,0)
1758 set Options(xcBox,xcWidth)=$get(width,0)
1759 if $data(InitDay) do
1760 . set Options(xcBox,xcDay)=InitDay
1761 . set Options(xcBox,xcMonth)=$get(InitMonth,0)
1762 . set Options(xcBox,xcYear)=$get(InitYear,0)
1763 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1764
1765 do xcalendarsel(.Options,.Results,xcModalMode)
1766
1767 if Results(xcDlgResult)=0 set result=$get(Results(xcDlgOutput,""))
1768
1769 quit result;
1770
1771xcalendarsel(Options,Results,Modal)
1772 ;" --calendar <text> <height> <width> [<day> <month> <year>]
1773
1774 do ParamTextAdd(.Options,vDialog)
1775 do SetCommons(.Options)
1776 do SetTrans(.Options)
1777 do ParamTextAdd(.Options," --calendar ")
1778
1779 set Added=$$AddParam(.Options,,xcText,xcAddQuote)
1780 set Added=$$AddParam(.Options,,xcHeight)
1781 set Added=$$AddParam(.Options,,xcWidth)
1782 if $data(Options(xcDay)) do
1783 . set Added=$$AddParam(.Options,,xcDay,xcNotOptional)
1784 . set Added=$$AddParam(.Options,,xcMonth,xcNotOptional)
1785 . set Added=$$AddParam(.Options,,xcYear,xcNotOptional)
1786
1787 do LaunchCmd(.Options,.Results,.Modal)
1788
1789 quit
1790
1791 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1792
1793TimeSel(Text,width,height,InitHour,InitMinute,InitSecond,x,y)
1794 ;"Purpose: To provide an easier access to Xdialog function
1795 ;" Shows a calendar and allows user to select date.
1796 ;"Input: Text -- a title / msg to show.
1797 ;" width,height -- the initial size of box. [Optional]
1798 ;" InitHour/Minute/Second -- Initial time to show.
1799 ;" NOTE: These three variables are optional BUT if InitDay given all 3 should be present.
1800 ;" x,y -- the display location of the dialog [optional]
1801 ;"Output:(none)
1802 ;"Results: returns the selected date
1803 ;"Notes: (none)
1804
1805 new Options
1806 new Results
1807 new result set result=""
1808
1809 if $data(xcCommon)=0 do SetupConsts()
1810
1811 set Options(xcBox,xcText)=$get(Text,"")
1812 set Options(xcBox,xcHeight)=$get(height,0)
1813 set Options(xcBox,xcWidth)=$get(width,0)
1814 if $data(InitHour) do
1815 . set Options(xcBox,xcHours)=InitDay
1816 . set Options(xcBox,xcMinutes)=$get(InitMinute,0)
1817 . set Options(xcBox,xcSeconds)=$get(InitSecond,0)
1818 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1819
1820 do xtimesel(.Options,.Results,xcModalMode)
1821
1822 if Results(xcDlgResult)=0 set result=$get(Results(xcDlgOutput,""))
1823
1824 quit result;
1825
1826xtimesel(Options,Results,Modal)
1827 ;" --timebox <text> <height> <width> [<hours> <minutes> <seconds>]
1828
1829 do ParamTextAdd(.Options,vDialog)
1830 do SetCommons(.Options)
1831 do SetTrans(.Options)
1832 do ParamTextAdd(.Options," --timebox ")
1833
1834 set Added=$$AddParam(.Options,,xcText,xcAddQuote)
1835 set Added=$$AddParam(.Options,,xcHeight)
1836 set Added=$$AddParam(.Options,,xcWidth)
1837 if $data(Options(xcHours)) do
1838 . set Added=$$AddParam(.Options,,xcHours,xcNotOptional)
1839 . set Added=$$AddParam(.Options,,xcMinutes,xcNotOptional)
1840 . set Added=$$AddParam(.Options,,xcSeconds,xcNotOptional)
1841
1842 do LaunchCmd(.Options,.Results,.Modal)
1843
1844 quit
1845
1846 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1847 ;"TO BE COMPLETED
1848
1849xbuildlist(Options,Results,Modal)
1850 ;" --buildlist <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
1851
1852 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1853 ;"TO BE COMPLETED
1854
1855xcolorsel(Options,Results,Modal)
1856 ;" --colorsel <text> <height> <width>
1857 new Added
1858
1859 do ParamTextAdd(.Options,vDialog)
1860 do SetCommons(.Options)
1861 do SetTrans(.Options)
1862 do ParamTextAdd(.Options," --colorsel ")
1863
1864 set Added=$$AddParam(.Options,,xcText,xcNotOptional,xcAddQuote)
1865 set Added=$$AddParam(.Options,,xcHeight)
1866 set Added=$$AddParam(.Options,,xcWidth)
1867
1868 do LaunchCmd(.Options,.Results,.Modal)
1869
1870 quit
1871
1872 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1873FontSel(InitFont,width,height,x,y)
1874 ;"Purpose: To provide an easier access to Xdialog function
1875 ;" Shows a font-pick
1876 ;"Input: InitFont -- name of initial font to show [Optional]
1877 ;" width,height -- the initial size of box. [Optional]
1878 ;" x,y -- the display location of the dialog [optional]
1879 ;"Output:(none)
1880 ;"Results: returns the selected date
1881 ;"Notes: (none)
1882
1883 new Options
1884 new Results
1885 new result set result=""
1886
1887 if $data(xcCommon)=0 do SetupConsts()
1888
1889 set Options(xcBox,xcFontName)=$get(InitFont,"")
1890 set Options(xcBox,xcHeight)=$get(height,0)
1891 set Options(xcBox,xcWidth)=$get(width,0)
1892 if $data(x) set Options(xcTransient,xcBegin)=x_" "_$get(y,0)
1893
1894 do xfontsel(.Options,.Results,xcModalMode)
1895
1896 if Results(xcDlgResult)=0 set result=$get(Results(xcDlgOutput,""))
1897
1898 quit result;
1899
1900
1901xfontsel(Options,Results,Modal)
1902 ;" --fontsel <font name> <height> <width>
1903 new Added
1904
1905 do ParamTextAdd(.Options,vDialog)
1906 do SetCommons(.Options)
1907 do SetTrans(.Options)
1908 do ParamTextAdd(.Options," --fontsel ")
1909
1910 set Added=$$AddParam(.Options,,xcFontName,xcNotOptional,xcAddQuote)
1911 set Added=$$AddParam(.Options,,xcHeight)
1912 set Added=$$AddParam(.Options,,xcWidth)
1913
1914 do LaunchCmd(.Options,.Results,.Modal)
1915
1916 quit
1917
1918 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1919ChClrScr()
1920 ;"Purpose: When working with text menus, after the dialog exits,
1921 ;" it leaves the drawing of the menu on the text screen.
1922 ;" So I'll have a function that clears the screen.
1923 ;"Note: I can't depend on the VistA system to have set up
1924 ;" variables that will clear the screen. So I'll do it quick and dirty
1925 ;" by many newline characters.
1926
1927 new count
1928
1929 for count=1:1:50 write !
1930
1931 quit
1932
1933 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1934 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1935
1936SetCommons(Options)
1937 ;"Purpose: to put common options into a parameter string that will be sent to Xdialog
1938 ;"Input: Options -- MUST BE PASSED BY REFERENCE
1939 ;" See docs re. Options above.
1940 ;"Output: The Options array will contain an entry containing output string:
1941 ;" Options(xcCmdLine)=<composite options>
1942
1943 new i
1944 new s set s=" "
1945 new AddQuote set AddQuote=0
1946
1947 if $data(xcCommon)=0 do SetupConsts() ;"Ensure constants created.
1948
1949
1950 set i=$order(Options(xcCommon,""))
1951 for do q:i=""
1952 . if i=xcCmdLine quit
1953 . if (i'=xcCmdLine)&($data(Options(xcCommon,i))'=0) do
1954 . . set s=s_"--"_i_" "
1955 . . if $get(Options(xcCommon,i))'=1 do
1956 . . . set s=s_""""_Options(xcCommon,i)_""" "
1957 . set i=$order(Options(xcCommon,i))
1958
1959 ;"set Options(xcCmdLine)=s
1960 do ParamTextAdd(.Options,s)
1961
1962 quit
1963
1964
1965SetTrans(Options)
1966 ;"Purpose: to put transient options into a parameter string that will be sent to Xdialog
1967 ;"Input: Options -- MUST BE PASSED BY REFERENCE
1968 ;" See docs re. Options above.
1969 ;"Output: The Options array will contain an entry containing output string:
1970 ;" Options(xcCmdLine)=<composite options>
1971 ;"Note: This function should be called AFTER SetCommons()
1972
1973 new i
1974 ;"new s set s=$get(Options(xcCmdLine))
1975 new s set s=" "
1976
1977 set i=$order(Options(xcTransient,""))
1978 for do q:i=""
1979 . if i=xcCmdLine quit
1980 . if (i'=xcCmdLine)&($data(Options(xcTransient,i))'=0) do
1981 . . set s=s_"--"_i_" "
1982 . . if $get(Options(xcTransient,i))'=1 set s=s_Options(xcTransient,i)_" "
1983 . set i=$order(Options(xcTransient,i))
1984
1985 ;"set Options(xcCmdLine)=$get(Options(xcCmdLine))_s
1986 do ParamTextAdd(.Options,s)
1987
1988 quit
1989
1990 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1991
1992AddParam(Options,N,index,optional,AddQuote)
1993 ;"Purpose: to add index'd box parameter to the composite parameters
1994 ;"Input: Options -- see above. MUST BE PASSED BY REFERENCE
1995 ;" N -- should NOT be passed, unless index item has a 'subscript', i.e.:
1996 ;" Options(xcBox,xcItem,1)="Bill"
1997 ;" Options(xcBox,xcItem,2)="Bill"
1998 ;" Options(xcBox,xcItem,3)="Bill"
1999 ;" index -- specifies which parameter to add (if found)
2000 ;" optional -- specifies if parameter is optional
2001 ;" default=not optional (0). Value of 1=is optional
2002 ;" AddQuote -- if parameter should be in quotes -- default is 0 / no
2003 ;"results: returns if data was added. (1=added, 0=not added)
2004
2005 new result set result=0
2006 new s,sCurrent
2007 new CurLine
2008 new Param
2009
2010 set optional=$get(optional,xcNotOptional)
2011 if optional'=xcNotOptional set optional=xcOptional
2012 set AddQuote=$get(AddQuote,xcNoQuote)
2013
2014 ;"write "Starting AddParam",!
2015
2016 set s=""
2017
2018 if $data(N) do ;"i.e. user is looking for a subscripted element...
2019 . set Param=$get(Options(xcBox,index,N))
2020 else do ;"i.e. user is NOT looking for a subscripted element...
2021 . set Param=$get(Options(xcBox,index))
2022
2023 if Param'="" do ;"Parameter found.
2024 . if AddQuote set s=s_""""
2025 . set s=s_Param
2026 . set result=1
2027 else do ;"There has not been any parameter found.
2028 . if $data(N) quit ;"If user was looking for (absent) subscripted param, then ignore NotOptional
2029 . if (optional=xcNotOptional) do
2030 . . if AddQuote set s=s_""""
2031 . . set s=s_"0" ;"put in a 0 for non-optional values.
2032 . . set result=1
2033
2034 if result=1 do
2035 . if (AddQuote=xcAddQuote) set s=s_""" "
2036 . else set s=s_" "
2037
2038 do ParamTextAdd(.Options,s)
2039
2040
2041 quit result
2042
2043ParamTextAdd(Options,Text)
2044 ;"Purpose: to actually add the text of the new parameter etc
2045 ;" into the Options variable
2046 ;"Input: Options .. same as variable used everywhere else
2047 ;" MUST BE PASSED BY REFERENCE
2048 ;" Text -- the text to add
2049
2050 new sCurrent
2051 new CurLine
2052
2053 ;"First the simple way -- with max of ~230 characters
2054 set Options(xcCmdLine)=$get(Options(xcCmdLine))_Text
2055
2056 ;"Next, array method, with unlimited length.
2057 set CurLine=$get(Options(xcCmdLine,xcCmdArray,xcCmdMaxLine),0)
2058 set sCurrent=$get(Options(xcCmdLine,xcCmdArray,CurLine))
2059 if $length(sCurrent)>80 do
2060 . set CurLine=CurLine+1
2061 . set sCurrent=""
2062
2063 set sCurrent=sCurrent_Text
2064 ;"write "After additions, sCurrent=",sCurrent,!
2065 set Options(xcCmdLine,xcCmdArray,CurLine)=sCurrent
2066 set Options(xcCmdLine,xcCmdArray,xcCmdMaxLine)=CurLine
2067 quit
2068
2069
2070LaunchCmd(Options,Results,Modal)
2071 ;"Purpose: To actually launch the dialog, and to retrieve results
2072 ;"Input: Options -- see Docs above. The only part of the Options array
2073 ;" that is used here is Options(xcCmdLine)
2074 ;" Results -- an array to pass results back in.
2075 ;" Modal -- if =xcModalMode, then execution does not continue until dialog is closed
2076 ;" if xcNonModal, then execution immediately continues. Note in this
2077 ;" case the result of the execution will be 0 (unless an error
2078 ;" occurs creating the dialog.) It will NOT be the result of
2079 ;" the user's button press.
2080
2081 new Cmd,HookCmd
2082 new FileHandle
2083 new CommFPath set CommFPath="/tmp/"
2084 new CommFName set CommFName="M_xdialog_comm_"_$J_".tmp"
2085 new CommFile set CommFile=CommFPath_CommFName
2086
2087 ;"set Cmd=vDialog_" "_$get(Options(xcCmdLine))
2088 ;"set Cmd=Cmd_" 2>"_CommFile
2089 do ParamTextAdd(.Options," 2>"_CommFile)
2090
2091 set Modal=$get(Modal,xcNonModal)
2092 if (Modal=xcNonModal) do
2093 . do ParamTextAdd(.Options," & ")
2094
2095 new result,killme
2096 new FRef
2097 ;"write "--------------------------------------------------",!
2098 ;"zwr Options(xcCmdLine,xcCmdArray,*)
2099 set FRef=$name(Options(xcCmdLine,xcCmdArray,0))
2100 set result=$$GTF^%ZISH(FRef,3,CommFPath,CommFName)
2101
2102 ;"set HookCmd="cat "_CommFile
2103 ;"write "Here is hook command",!,!,HookCmd,!,!
2104 ;"zsystem HookCmd
2105
2106 ;"Explaination of following line:
2107 ;"I can't always pass the command in one string, because of limitation of string length
2108 ;"So I am writing out the command as a text file (to CommFile)--which will have the long
2109 ;"string divided up into multiple lines. However, the bash command shell
2110 ;"can't deal with the command split up like this.
2111 ;"I have researched to find this method of stripping newlines from the end of
2112 ;"a line--there are probably 8 other ways to do this too. :-)
2113 ;" echo `<file` >file
2114 ;"I then execute the file by typing:
2115 ;" sh file
2116 ;"And the two commands are separated on the line by a ";"
2117 ;"So the composite is:
2118 ;" echo `<file` >file ; sh file
2119 ;"Note that the instructions contained in 'file' include an instruction to put
2120 ;" the output from the dialog back into 'file'. This is ok, because it won't
2121 ;" be overwriten until after the command has started to execute.
2122
2123 ;"set HookCmd="echo `<"_CommFile_"` >"_CommFile_" ; sh "_CommFile
2124 ;"write "Here is hook command",!,!,HookCmd,!,!
2125 ;"zsystem HookCmd
2126
2127 set HookCmd="echo `<"_CommFile_"` >"_CommFile
2128 ;"write "Here is hook command",!,!,HookCmd,!,!
2129 zsystem HookCmd
2130
2131 ;"set HookCmd="cat "_CommFile
2132 ;"write "Here is hook command",!,!,HookCmd,!,!
2133 ;"zsystem HookCmd
2134
2135 set HookCmd="sh "_CommFile
2136 ;"write "Here is hook command",!,!,HookCmd,!,!
2137 zsystem HookCmd
2138
2139
2140 set Results(xcDlgResult)=$ZSYSTEM&255 ;"get result of execution. (low byte only)
2141
2142 ;"Read output info Results
2143 ;"set HookCmd="cat "_CommFile
2144 ;"write "Here is hook command",!,!,HookCmd,!,!
2145 ;"zsystem HookCmd
2146 set FileHandle=$$FTG^%ZISH(CommFPath,CommFName,$name(Results(xcDlgOutput)),3)
2147 ;"zwr Results(*)
2148
2149 ;"Now kill the communication file... no longer needed.
2150 new FileSpec
2151 set FileSpec(CommFile)=""
2152 set result=$$DEL^%ZISH(CommFPath,$name(FileSpec))
2153
2154 quit
2155
2156
2157
2158 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
2159 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
2160
2161Demo
2162 ;"Purpose: To show the functionality of the library, and
2163 ;" to give a programming demo.
2164
2165
2166 new result
2167 new Feedback
2168 new s
2169 new UserPick,filename
2170 new UseGUI
2171
2172 set UseGUI=0
2173
2174 do SetupConsts()
2175
2176 do SetGUI(UseGUI)
2177
2178 new List
2179 set List(1,xcTag)="Graphic"
2180 set List(1,xcItem)="Select this for full X-system GUI"
2181 set List(1,xcStatus)="on"
2182 set List(2,xcTag)="Text"
2183 set List(2,xcItem)="Select this for character interface"
2184 set List(2,xcStatus)="off"
2185 set UserPick=$$RadioList("Which type of boxes would you like to use?",.List)
2186
2187 do ChClrScr^TMGXDLG()
2188
2189 if UserPick="Graphic" do
2190 . set UseGUI=1
2191 . do SetGUI(UseGUI)
2192
2193 if UseGUI=0 goto l1
2194
2195 set s="Welcome to the Xdialog Demo \nThis box is 'non-modal' "
2196 set s=s_"so its program can continue without"
2197 set s=s_"waiting for a user response."
2198 set result=$$Msg("Welcome",s,0,0,xcNonModal,1,2) ;"height&width of 0,0 means "auto size"
2199
2200l1
2201 set result=$$YesNo^TMGXDLG("Do you want to see a demo \n of this Xdialog wrapper library?")
2202 if result'=mrYes goto DemoDone
2203
2204 ;"Note: This don't seem to work in character mode...
2205 set s="OK, Check out this 'Info' box. It will auto close in 6 seconds"
2206 set result=$$Info(s,0,0,6,xcModalMode)
2207
2208 new List
2209 set List(1,xcTag)="Edit box"
2210 set List(1,xcItem)="Select this for an Edit Box"
2211 set List(1,xcStatus)="on"
2212 set List(2,xcTag)="Log box"
2213 set List(2,xcItem)="Select this for a Log Box"
2214 set List(2,xcStatus)="off"
2215 set List(3,xcTag)="Text box"
2216 set List(3,xcItem)="Select this for a Text Box"
2217 set List(3,xcStatus)="off"
2218 set List(4,xcTag)="Tail box"
2219 set List(4,xcItem)="Select this for a Tail Box"
2220 set List(4,xcStatus)="off"
2221 set UserPick=$$RadioList("Select Tool to See",.List)
2222
2223 write "You selected: ",UserPick,!
2224
2225 ;"Note: This don't seem to work in character mode...
2226 if UserPick'="" do
2227 . set filename=$$FileSel("Select a file to load")
2228 . if UserPick="Edit box" do quit
2229 . . set result=$$Edit(filename,0,0,.Feedback)
2230 . if UserPick="Log box" do quit
2231 . . set result=$$Log(filename,0,0,xcModalMode)
2232 . if UserPick="Text box" do quit
2233 . . set result=$$Text(filename,0,0,xcModalMode)
2234 . if UserPick="Tail box" do quit
2235 . . set result=$$Tail(filename,0,0,xcModalMode)
2236
2237 new FName,LName,Zip
2238 new DumpVar
2239
2240 set result=$$Input("Enter Name",0,0,"John",.FName)
2241 if result=mrCancel goto GBye
2242 write "Here is name:",FName,!
2243 ;"read "Press any key to coninue",*DumpVar,!
2244
2245 ;"Note: This not supported in character mode...
2246 set result=$$Input2("Enter Name",0,0,"First","John","Last","Smith",.FName,.LName)
2247 if result=mrCancel goto GBye
2248 write "Here is name:",FName," ",LName,!
2249 ;"read "Press any key to coninue",*DumpVar,!
2250
2251 ;"Note: This not supported in character mode...
2252 set result=$$Input3("Enter Name",0,0,"First","John","Last","Smith","Zip","12345",.FName,.LName,.Zip)
2253 if result=mrCancel goto GBye
2254 write "Here is name:",FName," ",LName,!
2255 write "zip: ",Zip,!
2256
2257 ;"Note: This not supported in character mode...
2258 kill List
2259 set List(1)="Cookies"
2260 set List(2)="Ice Cream"
2261 set List(3)="Cake"
2262 set result=$$Combo("Pick your favorite dessert:",0,0,.List)
2263 write "You picked: ",result,!
2264
2265 new Result1,Result2,Result3
2266
2267 ;"Note: This not supported in character mode...
2268 set result=$$Range("Enter some numbers",0,0,25,250,100,.Result1)
2269 if result=mrCancel goto GBye
2270 write "$=",Result1,!
2271
2272 ;"Note: This not supported in character mode...
2273 set result=$$Range2("Enter some numbers",0,0,"$",25,250,100,"%",33,66,44,.Result1,.Result2)
2274 if result=mrCancel goto GBye
2275 write "$=",Result1," and %=",Result2,!
2276
2277 ;"Note: This not supported in character mode...
2278 set result=$$Range3("Enter some numbers",0,0,"$",25,250,100,"%",33,66,44,"#",1000,2000,1500,.Result1,.Result2,.Result3)
2279 if result=mrCancel goto GBye
2280 write "$=",Result1," and %=",Result2," and #=",Result3,!
2281
2282 ;"Note: This not supported in character mode...
2283 set result=$$Spin("Enter a number",0,0,"$",25,250,100,.Result1)
2284 if result=mrCancel goto GBye
2285 write "$=",Result1,!
2286
2287 ;"Note: This not supported in character mode...
2288 set result=$$Spin2("Enter some numbers",0,0,"$",25,250,100,"%",33,66,44,.Result1,.Result2)
2289 if result=mrCancel goto GBye
2290 write "$=",Result1," and %=",Result2,!
2291
2292 ;"Note: This not supported in character mode...
2293 set result=$$Spin3("Enter some numbers",0,0,"$",25,250,100,"%",33,66,44,"#",1000,2000,1500,.Result1,.Result2,.Result3)
2294 if result=mrCancel goto GBye
2295 write "$=",Result1," and %=",Result2," and #=",Result3,!
2296
2297GBye
2298 set result=$$Msg("Goodbye","That''s all for now folks!",0,0,xcModalMode)
2299
2300 if UseGUI=0 do ChClrScr^TMGXDLG()
2301
2302DemoDone
2303 quit
2304
2305
2306 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
2307 ;"Progress Notes:
2308 ;"9-26-04 On my server, Xdialog was missing. I had to simply copy the
2309 ;" Xdialog file into /usr/bin ... I ought to have some way to
2310 ;" check for existance of file and give message if it is absent.
2311 ;"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Note: See TracBrowser for help on using the repository browser.