forked from patrickTingen/DataDigger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
showMessage.p
66 lines (54 loc) · 2.26 KB
/
showMessage.p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*------------------------------------------------------------------------
Name : showMessage.p
Description : Show a user defined message in a new window.
----------------------------------------------------------------------
16-09-2012 pti Created
----------------------------------------------------------------------*/
define input parameter pcTitle as character.
define input parameter pcMessage as character.
define output parameter phWindow as handle.
define variable cMessage as character no-undo format "x(256)".
define variable iFont as integer no-undo.
define variable iWidth as integer no-undo.
define variable winMessage as handle no-undo.
define frame infoFrame
cMessage view-as fill-in size 1 by 1 at row 1.5 col 1.5 no-label
with 1 down no-box overlay side-labels three-d at col 1 row 1 size-pixels 50 by 40.
/* ************************* Create Window ************************** */
create window winMessage assign
title = pcTitle
width-pixels = 260
height-pixels = 40
status-area = no
message-area = no
min-button = no
max-button = no
sensitive = yes.
/* Set CURRENT-WINDOW: this will parent dialog-boxes and frames. */
assign current-window = winMessage.
this-procedure:current-window = winMessage.
default-window = winMessage.
/* Find a decent font */
do iFont = 0 to font-table:num-entries - 1:
if font-table:get-text-width-pixels('DataDigger',iFont) = 54
and font-table:get-text-height-pixels(iFont) = 13 then
do:
frame infoFrame:font = iFont.
leave.
end.
end.
/* How wide should the text be? */
iWidth = font-table:get-text-width-pixels(pcMessage,iFont) + cMessage:x + 30.
iWidth = maximum(iWidth,150).
winMessage:width-pixels = iWidth .
cMessage:width-pixels = iWidth - 10.
cMessage:screen-value = pcMessage.
frame infoFrame:width-pixels = iWidth.
/* Center the window */
winMessage:x = (session:work-area-width-pixels - winMessage:width-pixels) / 2.
winMessage:y = (session:work-area-height-pixels - winMessage:height-pixels) / 2.
/* Showtime! */
view frame infoFrame in window winMessage.
view winMessage.
process events.
phWindow = winMessage:handle.