Reference manual

FICOTM Xpress
Optimization Suite

Xpress Application Developer
Reference manual
Release 1.2.9

Last update 18 October 2013www.fico.com

Make every decision countTM

This material is the confidential, proprietary, and unpublished property of Fair Isaac Corporation.
Receipt or possession of this material does not convey rights to divulge, reproduce, use, or allow
others to use it without the specific written authorization of Fair Isaac Corporation and use must
conform strictly to the license agreement.
The information in this document is subject to change without notice. If you find any problems inthis documentation, please report them to us in writing. Neither Fair Isaac Corporation nor its
affiliates warrant that this documentation is error-free, nor are there any other warranties withrespect to the documentation except as may be provided in the license agreement.
©1983–2017 Fair Isaac Corporation. All rights reserved. Permission to use this software and its
documentation is governed by the software license agreement between the licensee and Fair Isaac
Corporation (or its affiliate). Portions of the program may contain copyright of various authors andmay be licensed under certain third-party licenses identified in the software, documentation, orboth.
In no event shall Fair Isaac Corporation or its affiliates be liable to any person for direct, indirect,
special, incidental, or consequential damages, including lost profits, arising out of the use of thissoftware and its documentation, even if Fair Isaac Corporation or its affiliates have been advised ofthe possibility of such damage. The rights and allocation of risk between the licensee and Fair Isaac
Corporation (or its affiliates) are governed by the respective identified licenses in the software,
documentation, or both.
Fair Isaac Corporation and its affiliates specifically disclaim any warranties, including, but not limited
to, the implied warranties of merchantability and fitness for a particular purpose. The software andaccompanying documentation, if any, provided hereunder is provided solely to users licensed under
the Fair Isaac Software License Agreement. Fair Isaac Corporation and its affiliates have no
obligation to provide maintenance, support, updates, enhancements, or modifications except as
required to licensed users under the Fair Isaac Software License Agreement.
FICO and Fair Isaac are trademarks or registered trademarks of Fair Isaac Corporation in the UnitedStates and may be trademarks or registered trademarks of Fair Isaac Corporation in other countries.
Other product and company names herein may be trademarks of their respective owners.
FICO Xpress Optimization Suite
Deliverable Version: A
Last Revised: 18 October 2013
Version 1.2.9

Contents
1 XAD Applications

1

2 GUI creation with XAD

2

3 Lifetime of XAD objects

64 Events

7

5 XAD objects reference
5.1 Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4 Check button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5 Drop list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6 Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.7 Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.8 Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.9 List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.10 List with multiple columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.11 Progress bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.12 Radio button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.13 Scroll bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.14 Tab selectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.15 Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.16 Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.17 Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.18 Subroutines specific to objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreatewindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADwindowopen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADwindowclose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADwindowshow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADwindowhide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADwindowkeep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADwindowsettimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADwindowaddmenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreatetext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADtextaddtext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADtextsettext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADtextgettext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreatebutton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreateinput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADinputsettext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADinputgettext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreateeditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADeditoraddtext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADeditorload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

Fair Isaac Corporation Confidential and Proprietary Informationi

Contents

XADeditorsave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADeditorsettext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADeditorgettext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreatecheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADchecksetstate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcheckgetstate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreateradio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADradiosetstate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADradiogetstate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreategroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreatelist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADlistadd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADlistgetsel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADlistselect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADlistshow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreatedroplist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADdroplistadd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADdroplistgetsel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADdroplistselect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADdroplistshow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreateprogress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADprogressset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreatetab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADtabgettab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADtabsettab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreatemultilist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADmultilistshow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADmultilistsetsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADmultilistsetcolname . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADmultilistsettext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADmultilistgetsel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADmultilistsetcolors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADmultilistrefresh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreatecanvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawellipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvaserase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasrefresh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawimage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvassaveimage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawrectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawpolygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawpie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawarc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawchord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasdrawtext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcanvasunmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcolor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADcreatebrowser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADbrowsergoto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADbrowsergetmessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XADbrowsergetvalue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Fair Isaac Corporation Confidential and Proprietary Information

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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

ii

Contents

XADcreatescrollbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
XADscrollbargetpos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
XADscrollbarset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
XADcreatetree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
XADtreeadd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
XADtreereset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
XADtreeexpand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
5.19 Events specific to objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
XAD_BROWSER_MESSAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
XAD_EVENT_MENU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
XAD_EVENT_TIMER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
XAD_EVENT_WINDOW_CLOSED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
XAD_EVENT_WINDOW_CLOSING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
XAD_EVENT_WINDOW_HIDDEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
XAD_EVENT_WINDOW_MOVED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
XAD_EVENT_WINDOW_OPENED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
XAD_EVENT_WINDOW_RESIZED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
XAD_EVENT_WINDOW_SHOWN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
XAD_EVENT_PRESSED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
XAD_EVENT_CHANGED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
XAD_EVENT_SELECTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
6 XAD object groups reference
105
6.1 Group Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.2 Subroutines specific to groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
XADgroupcreate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
XADgroupaddmember . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
XADgroupdisband . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
XADgroupremovemember . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
XADgroupgetid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
XADgroupgeth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
XADgroupgetw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
XADgroupgetx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
XADgroupgety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
XADgroupsetpos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
XADgroupsetvisble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
XADgroupenable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
7 Generic routines
119
XADdestroy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
XADenable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
XADgetmousex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
XADgetmousey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
XADgetx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
XADgety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
XADgetw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
XADgeth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
XADgetid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
XADloadresource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
XADrefresh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
XADsetfocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
XADsetname . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
XADsetpos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
XADsettext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
XADsetvisible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

Fair Isaac Corporation Confidential and Proprietary Informationiii

Contents

XADgeteventtext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
8 Generic events
137
XAD_EVENT_KEYDOWN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
XAD_EVENT_KEYUP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
XAD_EVENT_MOUSE_LEFTDBCLK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
XAD_EVENT_MOUSE_LEFTDOWN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
XAD_EVENT_MOUSE_LEFTUP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
XAD_EVENT_MOUSE_MOVED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
XAD_EVENT_MOUSE_RIGHTDBCLK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
XAD_EVENT_MOUSE_RIGHTDOWN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
XAD_EVENT_MOUSE_RIGHTUP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
9 Utility routines
140
XADid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
XADsavescreenshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
XADseteventcallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
XADhandleevents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
XADchoosefile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
XADpopupmenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
XADgetsystemmetrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
XADgetdesktopwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
XADgetdesktopheight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
XADgetvirtualscreenwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
XADgetvirtualscreenheight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
XADgetvirtualscreenx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
XADgetvirtualscreeny . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
10 XAD examples
154
10.1 Simple example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
10.2 Resource Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
10.2.1 The Mosel Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
10.2.2 The Associated Resource File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
10.3 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

Appendix163

A Contacting FICO
163
Product support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Product education . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Product documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Sales and maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Related services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
About FICO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

Index

Fair Isaac Corporation Confidential and Proprietary Information

165

iv

C HAPTER 1

XAD Applications
High level applications of Mosel and XADBuild an interactive personnel assignment optimization application.



Visualize the performance in time of an asset portfolio model.

Prototype a bin packing model.

Cutting stock problems too difficult to understand? Use XAD to clear up the picture.



Deploy a facility location optimization application, with interactive GIS functionality.

Prototype and deploy a vehicle routing application.



Visualize strategic capacity planning with a 30-year horizon.

Take advantage of parallel computing and visualize concurrent optimization runs.



Write a simple text editor in 20 lines or less of Mosel code.



Build breakthtrough journaling/monitoring features which record how users interact withyour application.

Quickly build a visualization platform for your data, results, or both.



Build data input forms for your users.



Easily load and implement an application GUI created in the IVE resource editor.

Development with Mosel and XAD is contiguous and seamless. Construct the user interface using
the IVE drag and drop Resource Editor (see section 10.2 for an example), or write Mosel code tobuild both the user interface as well as the mathematical optimization model, data input/output
and pre/postprocessing. Save an order of magnitude of development time by not having toswitch editors, compilers, data paths, or even developers. The Mosel environment combined with
XAD enables fast and intuitive development.

Fair Isaac Corporation Confidential and Proprietary Information

1

C HAPTER 2

GUI creation with XAD
Xpress Application Developer (XAD) is an extension of the Xpress-Mosel modeling andprogramming language. Xpress Application Developer extends the functionality of Mosel with aset of functions and procedures for creating standard user interfaces. As a result, Mosel can beused as a modeling and programming language for complete optimization application
development, from the mathematical representation of a problem to developing the userinterface.
Xpress Application Developer can save significant amounts of time when experimenting with an
optimization problem because the OR practitioner no longer needs to interface Mosel with VB, or
C++, or Java in order to build a user application. Most features needed for GUI-based application
development are now available through the powerful yet easy to use abstractions in the Mosel
language.
An XAD user interface is composed of windows that can be opened or closed. Each window may
contain any number of XAD objects such as lists, buttons, checkboxes, etc. Every window as well
as every XAD object has a unique integer identifier (referred to as id) associated with it. The
identifier is associated with the graphical object at creation and is henceforth used to refer to therespective object later in the program/model.
The user may construct the GUI for the windows using either the XAD Resource Editor (part of
IVE and demonstrated in the 10.2 towards the end of this manual), or purely through Mosel code.
When creating the GUI(s) using the resource editor the layout and basic information about the
XAD objects is stored within an XML-like resource file and loaded directly in to XAD using
XADloadresource. As a consequence of having loaded all of the XAD objects in the background
you will not automatically have a reference to their ids. However, you will also not have had towrite out repeated lines of code to layout the objects within the window. In order to make use ofresource-loaded objects you must firstly retrieve their id using XADgetid; you may then use themas you would any XAD object. Resource-loaded objects also differ from their Mosel code
generated counterparts in one other manner: they all have a name which may be used to both
retrieve their id, and to call object-event specific events .
There are advantages and disadvantages to both the resource files and Mosel code approaches:
1. Resource File:(a) Advantage: Layout design is fast and easy using the IVE drag and drop resource editor.
(b) Advantage: The window and all of its objects may be loaded in Mosel using one
function call.
(c) Advantage: Events callbacks for each event may be specific to each object and window.
These are called simply by concatenation of the object’s name, the window’s name andthe event name, i.e.: Button_MainWindow_PRESSED(d) Disadvantage: To use any objects within the Mosel code you must retrieve the id using
XADgetid.

Fair Isaac Corporation Confidential and Proprietary Information

2

GUI creation with XAD

2. Pure Mosel Code:(a) Advantage: You do not require the extra resource file(s) to setup the window layout.
(b) Advantage: You can dynamically create the window layout at runtime.
(c) Disadvantage: If you wish to use the new form of event callback then you need toassign the object(s) names. Otherwise you must handle all of the events through thefunction specified in XADseteventcallback procedure.
(d) Disadvantage: If you want to change the layout of objects on a form you need tosearch through the code and compare positions and sizes numerically.
When the user interacts with an XAD object, events are generated. For example pressing abutton generates an XAD_EVENT_PRESSED; selecting an item in a list generates an
XAD_EVENT_SELECTION event. Events are processed in a callback routine written by the user.
The behavior of the user interface is determined by how the application responds to events. Any
Mosel code can be written for dealing with an event, including XAD statements for altering thestate of the user interface. This allows great flexibility in dealing with Mosel data as well asinteracting with the GUI.
The following, simple, example will demonstrate the principles of creating and managing an XAD
user interface using pure Mosel code. For an example using resource files see the example insection 10.2 towards the end of this manual; for detailed usage guides to the various resource
editor controls see the IVE help.
Suppose we want to write a Mosel program which displays a window asking for a number that isneeded later in the model:

Figure 2.1: Simple input window example

Let’s examine the code:

First we create a window and assign the id id_win to it. Then we create three XAD objects: adescriptive text, an input field and a button, each with a different id. The ids should be longer
rather than shorter and they should provide type information to make the model more readable
and maintainable.
As an alternative to creating the window using several lines of Mosel code we may also create thewindow and associated objects using the IVE XAD Resource Editor (see the IVE help files for more
information) and load them using the XAD procedure XADloadresource.

Fair Isaac Corporation Confidential and Proprietary Information

3

GUI creation with XAD

Next:

The event handler is the core of an XAD program. All the interaction between the user and the
GUI is reflected through the event handler. The event handler is a callback procedure that takes
two arguments of type integer. XAD will call this procedure when an event occurs. The
arguments are:id:

integer

The id of the XAD object that generated the event

event:

integer

A number which denotes an event (e.g. XAD_EVENT_PRESSED)

Note that some events such as key presses and list selections carry textual information. If thisinformation is needed, it can be retrieved in the event handler using the routine
XADgeteventtext: string
In our simple case, if the object id_buttonok is pressed then we close the window. When thewindow is closed, the text currently in the input object id_inputnumber is converted to a real
number and assigned to N. Thirdly, for improved user interaction, we set the focus on the input
object as soon as the window is opened.
Finally:

The procedure which handles the events (the event handler) must be registered with XAD bycalling XADseteventcallback with the event handler procedure name as the sole argument.
You may, if you are using resource-loaded objects, create event callbacks by creating procedures
named by the concatenation of the object name, window name and event type. For example the
Exit_Window_PRESSED procedure as mentioned in section 10.2 is the event callback which will
be called when the Exit button, resident in the window called Window, is pressed (receives the
PRESSED event).
Once the event handler is in place we can open (show) the window. When closing the window(by pressing the OK button or clicking the close button or pressing Esc), Mosel will resume its
execution from the statement immediately following XADwindowopen.
A few notes on using XAD with Mosel:

XAD code may be placed anywhere in a Mosel model, however, the user is encouraged toseparate the code implementing the visual functionality from other modeling/programmingstatements, as needed.

In order to run a model which uses mmxad.dso, the library must be present in the dso folderof the FICOTM Xpress installation (or pointed to be the MOSEL_DOS environment variable)

Fair Isaac Corporation Confidential and Proprietary Information

4

GUI creation with XAD

and properly licensed through the license file. Xpress-IVE is not needed—XAD is anindependent library which only requires the Mosel runtime library.

Fair Isaac Corporation Confidential and Proprietary Information

5

C HAPTER 3

Lifetime of XAD objects
An XAD object will exist until the model ends or until it is destroyed using XADdestroy. The
object-specific routines (listed in the reference part of this document) can only operate on an
object when the window containing the object is active (or, if the object is a window, only while
the window is active). For this reason, the event XAD_EVENT_WINDOW_OPENED is of particularinterest: it is the only chance to operate on the objects in a window before the window begins
interacting with the user.
There are two distinct ways in which windows may behave:
1. When a window is opened (using XADwindowopen), the window takes control of the Mosel
program. Until the window is closed (using XADwindowclose) the only way to execute codeis from the event handler (directly, or by calling a subroutine). The statement following
XADwindowopen will only be executed after the user has closed the window. This behavior
can be used when user input is necessary before the program can continue or when the userinterface is meant to control the Mosel program. This type of window is referred to as amodal dialog.
2. When a window is shown (using XADwindowshow), the window is displayed and Mosel
continues immediately. A shown window should be used as an auxiliary window formonitoring program state, to display progress, etc. When the monitoring is complete (e.g.
at the end of the Mosel run), the window may be hidden, using XADwindowhide. If thewindow is not hidden before the Mosel run ends, it will persist until the model is unloaded
from memory (in Xpress-IVE this only happens when compiling or running a model). This
type of window is referred to as a modeless dialog.
It is important to make a correct choice between the two behaviors. Experiment until the
distinction is well understood, and keep in mind that for most purposes a window should be
opened in order to allow it to take control of the program execution by generating events.

Fair Isaac Corporation Confidential and Proprietary Information

6

C HAPTER 4

EventsWhen the user operates on a window or object in a window, the action is reported through anevent. The event handler callback procedure can be used to respond to such events. For example,
when the user presses a button, the event handler callback procedures is called with twoarguments: an integer representing the id of the button that triggered the event and anotherinteger representing the event code XAD_EVENT_PRESSED. Or, when the user resizes a windowby dragging its margins, the event is reported as a call to the event handler callback with thewindow id and XAD_EVENT_WINDOW_RESIZED as arguments.
Events specific to objects:
XAD_BROWSER_MESSAGE

Browser event message

p. 102

XAD_EVENT_CHANGED

Input, editor or scrollbar changed event.

p. 104

XAD_EVENT_MENU

Menu event.

p. 102

XAD_EVENT_PRESSED

Button pressed event.

p. 104

XAD_EVENT_SELECTION

Selection event.

p. 104

XAD_EVENT_TIMER

Timer event.

p. 102

XAD_EVENT_WINDOW_CLOSEDWindow closed event.

p. 103

XAD_EVENT_WINDOW_CLOSING

Window closing event.

p. 103

XAD_EVENT_WINDOW_HIDDEN

Window hidden event.

p. 103

XAD_EVENT_WINDOW_MOVED

Window moved event.

p. 103

XAD_EVENT_WINDOW_OPENEDWindow opened event.

p. 103

XAD_EVENT_WINDOW_RESIZEDWindow resized event.

p. 103

XAD_EVENT_WINDOW_SHOWN

Window shown event.

p. 104

XAD_EVENT_KEYDOWN

Key pressed.

p. 137

XAD_EVENT_KEYUP

Key released.

p. 138

XAD_EVENT_MOUSE_LEFTDBCLK

Double click with left mouse button.

p. 138

XAD_EVENT_MOUSE_LEFTDOWN

Left mouse button pressed.

p. 138

XAD_EVENT_MOUSE_LEFTUP

Left mouse button released.

p. 138

XAD_EVENT_MOUSE_MOVED

Mouse moved.

p. 138Generic events:

Fair Isaac Corporation Confidential and Proprietary Information

7

Events

XAD_EVENT_MOUSE_RIGHTDBCLK

Double click with right mouse button.

p. 139

XAD_EVENT_MOUSE_RIGHTDOWN

Right mouse button pressed.

p. 139

XAD_EVENT_MOUSE_RIGHTUP

Right mouse button released.

p. 139Fair Isaac Corporation Confidential and Proprietary Information

8

C HAPTER 5

XAD objects reference
XAD provides functionality to work with the following graphical objects:

5.1



Browser (5.1)



Button (5.2)

Canvas (5.3)

Check button (5.4)

Drop list (5.5)



Editor (5.6)

Group (5.7)



Input (5.8)



List (5.9)

Multilist (5.10)

Progress bar (5.11)

Radio button (5.12)



Scroll bar (5.13)



Tab (5.14)



Text (5.15)

Tree (5.16)



Window (5.17)

Browser
An Internet Explorer-based web browser which can display any webpage.

Fair Isaac Corporation Confidential and Proprietary Information

9

XAD objects reference

Specific subroutines
XADcreatebrowser, XADbrowsergoto
Specific events
None

5.2

ButtonA regular push button.

Specific subroutines
XADcreatebutton
Specific events
XAD_EVENT_PRESSED

5.3

CanvasAn intuitive surface for drawing anything using XAD.

Fair Isaac Corporation Confidential and Proprietary Information

10

XAD objects reference

Specific subroutines
XADcreatecanvas, XADcanvasdrawarc, XADcanvasdrawbox, XADcanvasdrawchord,
XADcanvasdrawellipse, XADcanvasdrawimage, XADcanvasdrawline, XADcanvasdrawpie,
XADcanvasdrawpoint, XADcanvasdrawpolygon, XADcanvasdrawrectangle,
XADcanvasdrawtext, XADcanvaserase, XADcanvasmap, XADcanvasrefresh,
XADcanvassaveimage, XADcanvasunmap
Specific events
None
Note

5.4

Working with colors. XAD recognizes the following color constants: XAD_BLACK, XAD_BLUE,XAD_CYAN, XAD_GREEN, XAD_MAGENTA, XAD_ORANGE, XAD_RED, XAD_WHITE, XAD_YELLOW Use
XADcolor to create any other color based on its red, green and blue components.

Check button
A button with two states: checked and unchecked. It is independent of any other objects.

Specific subroutines
XADcreatecheck, XADcheckgetstate, XADchecksetstateSpecific events
XAD_EVENT_PRESSED

5.5

Drop list
A sortable list of strings, numbers, etc., which can be expanded or collapsed.

Fair Isaac Corporation Confidential and Proprietary Information

11

XAD objects reference

Specific subroutines
XADcreatedroplist, XADdroplistadd, XADdroplistgetsel, XADdroplistselect,
XADdroplistshow
Specific events
XAD_EVENT_SELECTION
Note

5.6

A list object generates an XAD_EVENT_SELECTION event when the user changes the selection. In
order to find out which item was selected, call the function XADgeteventtext:string.

Editor
A field for editing multi-line text.

Specific subroutines
XADcreateeditor, XADeditoraddtext, XADeditorgettext XADeditorload,
XADeditorsave, XADeditorsettext
Specific events
XAD_EVENT_CHANGED

5.7

Group
A thin frame surrounding a group of related objects.

Fair Isaac Corporation Confidential and Proprietary Information

12

XAD objects reference

Specific subroutines
XADcreategroup
Specific events
None

5.8

Input
A single line input field.

Specific subroutines
XADcreateinput, XADinputgettext, XADinputsettext
Specific events
XAD_EVENT_CHANGED

5.9

List
A sortable list of strings, numbers, etc.

Fair Isaac Corporation Confidential and Proprietary Information

13

XAD objects reference

Specific subroutines
XADcreatelist, XADlistadd, XADlistgetsel, XADlistselect, XADlistshow
Specific events
XAD_EVENT_SELECTIONNote

A list object generates an XAD_EVENT_SELECTION event when the user changes the selection. In
order to find out which item was selected, call the function XADgeteventtext:string.

5.10

List with multiple columns
A sortable list of strings, numbers, etc. which can display multidimensional data.

Specific subroutines
XADcreatemultilist, XADmultilistrefresh, XADmultilistsetcolname,
XADmultilistsetsize, XADmultilistsettext, XADmultilistshow
Specific events
None

5.11

Progress bar
A visual progress indicator.

Fair Isaac Corporation Confidential and Proprietary Information

14

XAD objects reference

Specific subroutines
XADcreateprogress, XADprogressset
Specific events
None

5.12

Radio button
A button with two states: checked and unchecked. It can be used for mutually exclusive choices.

Specific subroutines
XADcreateradio, XADradiogetstate, XADradiosetstateSpecific events
XAD_EVENT_PRESSED

5.13

Scroll bars
A vertical or horizontal scrollbar for controlling position in a large document.

Fair Isaac Corporation Confidential and Proprietary Information

15

XAD objects reference

Specific subroutines
XADcreatescrollbar, XADscrollbargetpos, XADscrollbarset
Specific events
XAD_EVENT_CHANGED
Note

A scrollbar object generates an XAD_EVENT_CHANGED event when the user interacts with it. Use
XADscrollbargetpos to obtain the new position.

5.14

Tab selectors
A notebook-style object for choosing among general categories (of other objects, usually).

Specific subroutines
XADcreatetab, XADtabgettab, XADtabsettab
Specific events
XAD_EVENT_SELECTIONNote

A tab object generates an XAD_EVENT_SELECTION event when the user changes the selection. In
order to find out which tab was selected, call the function XADgeteventtext:string or use
XADtabgettab.

5.15

Text
A multiline label for displaying text information.

Fair Isaac Corporation Confidential and Proprietary Information

16

XAD objects reference

Specific subroutines
XADcreatetext, XADtextaddtext, XADtextgettext, XADtextsettext
Specific events
None

5.16

Tree
A hierarchical tree display.

Specific subroutines
XADcreatetree, XADtreeadd, XADtreereset, XADtreeexpand
Specific events
XAD_EVENT_SELECTION

5.17

Window
The most important object; brings together all the other types of objects and allows interaction
with the user.

Fair Isaac Corporation Confidential and Proprietary Information

17

XAD objects reference

Specific subroutines
XADcreatewindow, XADwindowaddmenu, XADwindowclose, XADwindowhide, XADwindowkeep,
XADwindowopen, XADwindowsettimer, XADwindowshow
Specific events
XAD_EVENT_MENU, XAD_EVENT_TIMER, XAD_EVENT_WINDOW_CLOSED,XAD_EVENT_WINDOW_CLOSING, XAD_EVENT_WINDOW_HIDDEN, XAD_EVENT_WINDOW_MOVED,
XAD_EVENT_WINDOW_OPENED, XAD_EVENT_WINDOW_RESIZED, XAD_EVENT_WINDOW_SHOWN

5.18

Subroutines specific to objects
XADbrowsergetmessage

Returns the query string of the last HTTP POST from within thebrowser object to the action URL "xad://"p. 93

XADbrowsergetvalue

Returns the value of a field from the last HTTP POST from within
the browser object to the action URL "xad://"p. 94

XADbrowsergoto

Open the given URL in the browser.

p. 92

XADcanvasdrawarc

Draw an elliptical arc on a canvas.

p. 85

XADcanvasdrawbox

Draw a box on a canvas.

p. 74

XADcanvasdrawchord

Draw an elliptical chord on a canvas.

p. 86

XADcanvasdrawellipse

Draw an ellipse on a canvas.

p. 75

XADcanvasdrawimage

Draw an image from file.

p. 78

XADcanvasdrawline

Draw a line on a canvas.

p. 80

XADcanvasdrawpie

Draw an elliptical pie slice on a canvas.

p. 84

XADcanvasdrawpoint

Draw a point on a canvas.

p. 81

XADcanvasdrawpolygon

Draw a polygon on a canvas.

p. 83

XADcanvasdrawrectangle

Draw a rectangle on a canvas.

p. 82

XADcanvasdrawtext

Draw text on a canvas.

p. 87

XADcanvaserase

Erase a canvas.

p. 76

XADcanvasmap

Map the coordinate space of a canvas.

p. 88

XADcanvasrefresh

Redraw a canvas.

p. 77

XADcanvassaveimage

Save an image to memory.

p. 79

Fair Isaac Corporation Confidential and Proprietary Information

18

XAD objects reference

XADcanvasunmap

Revert to default mapping for a canvas.

p. 89

XADcheckgetstate

Get the state of a check button.

p. 45

XADchecksetstate

Set the state of a check button.

p. 44

XADcolor

Create a color value.

p. 90

XADcreatebrowser

Create a browser.

p. 91

XADcreatebutton

Create a button object.

p. 33

XADcreatecanvas

Create a canvas object.

p. 73

XADcreatecheck

Create a check button.

p. 43

XADcreatedroplist

Create a droplist object.

p. 55

XADcreateeditor

Create an editor object.

p. 37

XADcreategroup

Create a group object.

p. 49

XADcreateinput

Create an input object.

p. 34

XADcreatelist

Create a list object.

p. 50

XADcreatemultilist

Create a multilist object.

p. 65

XADcreateprogress

Create a progress bar.

p. 60

XADcreateradio

Create a radio button.

p. 46

XADcreatescrollbar

Create a scrollbar object.

p. 95

XADcreatetab

Create a tab selector object.

p. 62

XADcreatetext

Create a text object.

p. 29

XADcreatetree

Create a tree object.

p. 98

XADcreatewindow

Create a window

p. 21

XADdroplistadd

Add an item to a droplist

p. 56

XADdroplistgetsel

Get the selected item from a droplist.

p. 57

XADdroplistselectSelect a droplist itemp. 58

XADdroplistshow

Show a droplist.

p. 59

XADeditoraddtext

Add text to an editor.

p. 38

XADeditorgettext

Get the text from an editor.

p. 42

XADeditorload

Load a file into an editor.

p. 39

XADeditorsave

Save editor contents into a file.

p. 40

XADeditorsettext

Set the text of an editor.

p. 41

XADinputgettext

Get the text of an input object.

p. 36

XADinputsettext

Set the text of an input object.

p. 35

XADlistadd

Add an item to a list

p. 51

XADlistgetsel

Get the selected item from a list.

p. 52

Fair Isaac Corporation Confidential and Proprietary Information

19

XAD objects reference

XADlistselectSelect a list itemp. 53

XADlistshow

Show a list.

p. 54

XADmultilistgetsel

Retrieve the selected multilist item.

p. 70

XADmultilistrefresh

Update the visual display.

p. 72

XADmultilistsetcolname

Set multilist column names.

p. 68

XADmultilistsetcolors

Set the multilist item colour for a particular cell.

p. 71

XADmultilistsetsize(Re)set the size of a multilist.

p. 67

XADmultilistsettext

Set a multilist item.

p. 69

XADmultilistshow

Load and display multi-dimensional arrays in a multilist.

p. 66

XADprogressset

Set the progress state.

p. 61

XADradiogetstate

Get the state of a radio button.

p. 48

XADradiosetstate

Get the state of a radio button.

p. 47

XADscrollbargetpos

Obtain the current position of the scrollbar.

p. 96

XADscrollbarset

Set scrollbar characteristics.

p. 97

XADtabgettab

Get the current tab selection.

p. 63

XADtabsettab

Select a given tab.

p. 64

XADtextaddtext

Add text to a text object.

p. 30

XADtextgettext

Get the text of a text object.

p. 32

XADtextsettext

Set text of a text object.

p. 31

XADtreeadd

Add a branch to a tree

p. 99

XADtreeexpand

Expands a tree branch .

p. 101

XADtreereset

Clears the content of a tree

p. 100

XADwindowaddmenu

Add a dropdown menu to the window.

p. 28

XADwindowclose

Close a window.

p. 23

XADwindowhide

Hide a window.

p. 25

XADwindowkeep

Keep a window.

p. 26

XADwindowopen

Open a window.

p. 22

XADwindowsettimer(Re)set a timer.

p. 27

XADwindowshow

Display a window.

p. 24

Fair Isaac Corporation Confidential and Proprietary Information

20

XAD objects reference

XADcreatewindow
PurposeCreate a window
Synopsisprocedure XADcreatewindow(id:integer, x:integer, y:integer, w:integer,
h:integer, name:string)Arguments
id
x
y
w
h
name

Arbitrary unique id of the window
x coordinate (from left of screen) of the window in pixels
y coordinate (from top of screen) of the window in pixels
Width of the window in pixels
Height of the window in pixels
The title of the window

Related topics
XADwindowopen, XADwindowclose, XADwindowshow, XADwindowhide, XADwindowkeep,
XADwindowsettimer

Fair Isaac Corporation Confidential and Proprietary Information

21

XAD objects reference

XADwindowopen
PurposeOpen a window.
Synopsisprocedure XADwindowopen(id:integer)
Argument
id

Window identifier

Further information
Displays the window and surrenders execution control to its event handler callback.
Related topics
XADwindowclose

Fair Isaac Corporation Confidential and Proprietary Information

22

XAD objects reference

XADwindowclose
PurposeClose a window.
Synopsisprocedure XADwindowclose(id:integer)
Argument
id

Window identifier

Further information
Destroys an opened window.
Related topics
XADwindowopen

Fair Isaac Corporation Confidential and Proprietary Information

23

XAD objects reference

XADwindowshow
Purpose
Display a window.
Synopsisprocedure XADwindowshow(id:integer)
Argument
id

Window identifier

Further information
Displays the window and execution resumes immediately.
Related topics
XADwindowhide

Fair Isaac Corporation Confidential and Proprietary Information

24

XAD objects reference

XADwindowhide
PurposeHide a window.
Synopsisprocedure XADwindowhide(id:integer)
Argument
id

Window identifier

Further information
Destroys a shown window.
Related topics
XADwindowshow

Fair Isaac Corporation Confidential and Proprietary Information

25

XAD objects reference

XADwindowkeep
PurposeKeep a window.
Synopsisprocedure XADwindowkeep
Further information
Should be used only when dealing with the XAD_EVENT_WINDOW_CLOSING event, if the intent is
to cancel the closing of the window. For example, if an exit confirmation dialog is shown and theuser changes his mind, call this procedure to prevent the window from closing.
Related topics
XADwindowhide

Fair Isaac Corporation Confidential and Proprietary Information

26

XAD objects reference

XADwindowsettimer
Purpose(Re)set a timer.
Synopsisprocedure XADwindowsettimer(id:integer, msec:integer)
Argumentsid
msec

Window identifier
Timer interval in milliseconds

Further information
Sets or resets a timer that generates XAD_EVENT_TIMER events. If msec is a positive integer, theevent will be generated every msec milliseconds. If msec is 0 or negative, the timer is reset (timer
events are no longer generated)

Fair Isaac Corporation Confidential and Proprietary Information

27

XAD objects reference

XADwindowaddmenu
PurposeAdd a dropdown menu to the window.
Synopsisprocedure XADwindowaddmenu(id:integer, title:string, items:string)procedure XADwindowaddmenu(id:integer, title:string, itemset: set of
string)Arguments
id
title
items
itemsetWindow identifier
Menu title (e.g. File, Edit)
Comma-separated list of strings representing the menu items
Set of strings representing the menu items

ExampleXADwindowaddmenu(id_win, "", "") !pass empty string to clear existing menu, if
XADwindowaddmenu(id_win, "&File", "&New,&Open,&Save,XADseparator,E&xit")
XADwindowaddmenu(id_win, "&Help", "&Help on MyApp,&About...")
Further information
Respond to menu selections by checking the XAD_EVENT_MENU event.
Use the ampersand character & to create a Alt+letter hotkey for each menu item.
Use the string "XADseparator" to insert a line separator in the menu.
Pass an empty title to reset and destroy the menu. Then rebuild the entire menu.

Fair Isaac Corporation Confidential and Proprietary Information

28

XAD objects reference

XADcreatetext
PurposeCreate a text object.
Synopsisprocedure XADcreatetext(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, name:string)Arguments
wid
id
x
y
w
h
text

id of the window containing the text
Text identifier
x coordinate (from left of window) of the text in pixels
y coordinate (from top of window) of the text in pixels
Width of the text in pixels
Height of the text in pixels
Contents of the text object (use \r\n to break lines)

Related topics
XADtextaddtext, XADtextgettext, XADtextsettext

Fair Isaac Corporation Confidential and Proprietary Information

29

XAD objects reference

XADtextaddtext
PurposeAdd text to a text object.
Synopsisprocedure XADtextaddtext(id:integer, text:string)Argumentsidtext

Text identifier
Text to be added

Further information
Appends the given text to the object.
Related topics
XADtextgettext, XADtextsettext

Fair Isaac Corporation Confidential and Proprietary Information

30

XAD objects reference

XADtextsettext
PurposeSet text of a text object.
Synopsisprocedure XADtextsettext(id:integer, text:string)Argumentsidtext

Text identifier
New text

Further information
Replaces the text of the object with the new text.
Related topics
XADtextaddtext, XADtextgettext

Fair Isaac Corporation Confidential and Proprietary Information

31

XAD objects reference

XADtextgettext
PurposeGet the text of a text object.
Synopsisfunction XADtextgettext(id:integer):stringArgument
id

Text identifier

Return value
Text of the object.
Further information
Obtains the text currently shown by the object.
Related topics
XADtextaddtext, XADtextsettext

Fair Isaac Corporation Confidential and Proprietary Information

32

XAD objects reference

XADcreatebutton
PurposeCreate a button object.
Synopsisprocedure XADcreatebutton(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, name:string)Arguments
wid
id
x
y
w
h
name

id of the window containing the button
Button identifier
x coordinate (from left of window) of the button in pixels
y coordinate (from top of window) of the button in pixels
Width of the button in pixels
Height of the button in pixels
The name of the button

Fair Isaac Corporation Confidential and Proprietary Information

33

XAD objects reference

XADcreateinput
PurposeCreate an input object.
Synopsisprocedure XADcreateinput(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, text:string)Arguments
wid
id
x
y
w
h
text

id of the window containing the input
Input identifier
x coordinate (from left of window) of the input in pixels
y coordinate (from top of window) of the input in pixels
Width of the input in pixels
Height of the input in pixels
Initial content of the input object

Related topics
XADinputgettext, XADinputsettext

Fair Isaac Corporation Confidential and Proprietary Information

34

XAD objects reference

XADinputsettext
PurposeSet the text of an input object.
Synopsisprocedure XADinputsettext(id:integer, text:string)Argumentsid
text

Input identifier
New text

Further information
Replaces the text of the object with the new text.
Related topics
XADinputgettext

Fair Isaac Corporation Confidential and Proprietary Information

35

XAD objects reference

XADinputgettext
PurposeGet the text of an input object.
Synopsisfunction XADinputgettext(id:integer):stringArgument
id

Input identifier

Return value
Text of the object.
Further information
Obtains the text currently shown by the object.
Related topics
XADinputsettext

Fair Isaac Corporation Confidential and Proprietary Information

36

XAD objects reference

XADcreateeditor
PurposeCreate an editor object.
Synopsisprocedure XADcreateeditor(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, text:string)Arguments
wid
id
x
y
w
h
text

id of the window containing the editor
Editor identifier
x coordinate (from left of window) of the editor in pixels
y coordinate (from top of window) of the editor in pixels
Width of the editor in pixels
Height of the editor in pixels
Contents of the editor object (use \r\n to break lines)

Related topics
XADeditoraddtext, XADeditorload, XADeditorsave, XADeditorsettext,
XADeditorgettext

Fair Isaac Corporation Confidential and Proprietary Information

37

XAD objects reference

XADeditoraddtext
PurposeAdd text to an editor.
Synopsisprocedure XADeditoraddtext(id:integer, text:string)Argumentsidtext

Editor identifier
Text to be added

Further information
Appends the given text to the object.
Related topics
XADeditorsettext, XADeditorgettext

Fair Isaac Corporation Confidential and Proprietary Information

38

XAD objects reference

XADeditorload
PurposeLoad a file into an editor.
Synopsisprocedure XADeditorload(id:integer, file:string)Arguments
id
file

Editor identifier
File name

Further information
Load the specified file into the editor, replacing its previous content.
Related topics
XADeditorsave

Fair Isaac Corporation Confidential and Proprietary Information

39

XAD objects reference

XADeditorsave
PurposeSave editor contents into a file.
Synopsisprocedure XADeditorsave(id:integer, file:string)Arguments
id
file

Editor identifier
File name

Further information
Saves the contents of the editor to the specified file.
Related topics
XADeditorload

Fair Isaac Corporation Confidential and Proprietary Information

40

XAD objects reference

XADeditorsettext
PurposeSet the text of an editor.
Synopsisprocedure XADeditorsettext(id:integer, text:string)Argumentsidtext

Editor identifier
New text

Further information
Replaces the text of the object with the new text.
Related topics
XADeditoraddtext, XADeditorgettext

Fair Isaac Corporation Confidential and Proprietary Information

41

XAD objects reference

XADeditorgettext
PurposeGet the text from an editor.
Synopsisfunction XADeditorgettext(id:integer):stringArgument
id

Editor identifier

Return value
Text of the object.
Further information
Obtains the text currently shown by the object.
Related topics
XADeditoraddtext, XADeditorsettext,

Fair Isaac Corporation Confidential and Proprietary Information

42

XAD objects reference

XADcreatecheck
PurposeCreate a check button.
Synopsisprocedure XADcreatecheck(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, name:string)Arguments
wid
id
x
y
w
h
name

id of the window containing the check
Check identifier
x coordinate (from left of window) of the check in pixels
y coordinate (from top of window) of the check in pixels
Width of the check in pixels
Height of the check in pixels
Description of the check object

Related topics
XADchecksetstate, XADcheckgetstate

Fair Isaac Corporation Confidential and Proprietary Information

43

XAD objects reference

XADchecksetstate
PurposeSet the state of a check button.
Synopsisprocedure XADchecksetstate(id:integer, state:boolean)
Arguments
id
Check identifier
state Button state.
true
checkedfalse
unchecked
Further information
Sets the state of the check to checked or unchecked.
Related topics
XADcheckgetstate

Fair Isaac Corporation Confidential and Proprietary Information

44

XAD objects reference

XADcheckgetstate
PurposeGet the state of a check button.
Synopsisfunction XADcheckgetstate(id:integer):boolean
Argument
id

Check identifier

Return value
true Button is checked
false Button is unchecked
Further information
Obtains the state of the check (true for checked, false for unchecked).
Related topics
XADchecksetstate

Fair Isaac Corporation Confidential and Proprietary Information

45

XAD objects reference

XADcreateradio
PurposeCreate a radio button.
Synopsisprocedure XADcreateradio(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, name:string)Arguments
wid
id
x
y
w
h
name

id of the window containing the radio
Radio identifier
x coordinate (from left of window) of the radio in pixels
y coordinate (from top of window) of the radio in pixels
Width of the radio in pixels
Height of the radio in pixels
Name of the radio button object

Related topics
XADradiosetstate, XADradiogetstate

Fair Isaac Corporation Confidential and Proprietary Information

46

XAD objects reference

XADradiosetstate
PurposeGet the state of a radio button.
Synopsisprocedure XADradiosetstate(id:integer, state:boolean)
Arguments
id
Radio identifier
state Button state.
true
selected
false
unselected
Further information
Sets the state of the radio to selected (true) or unselected (false).
Related topics
XADradiogetstate

Fair Isaac Corporation Confidential and Proprietary Information

47

XAD objects reference

XADradiogetstate
PurposeGet the state of a radio button.
Synopsisfunction XADradiogetstate(id:integer):boolean
Arguments
id

Radio identifier

Return value
true Radio button is selected
false Radio button is unselected
Further information
Obtains the state of the radio (true for selected, false for unselected).
Related topics
XADradiosetstate

Fair Isaac Corporation Confidential and Proprietary Information48

XAD objects reference

XADcreategroup
PurposeCreate a group object.
Synopsisprocedure XADcreategroup(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, name:string)Arguments
wid
id
x
y
w
h
name

id of the window containing the group
Group identifier
x coordinate (from left of window) of the group in pixels
y coordinate (from top of window) of the group in pixels
Width of the group in pixels
Height of the group in pixels
Description of the group

Fair Isaac Corporation Confidential and Proprietary Information

49

XAD objects reference

XADcreatelist
PurposeCreate a list object.
Synopsisprocedure XADcreatelist(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, name:string)procedure XADcreatelist(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, name:string, sorted:boolean)
Arguments
wid
id
x
y
w
h
name
sortedid of the window containing the list
List identifier
x coordinate (from left of window) of the list in pixels
y coordinate (from top of window) of the list in pixels
Width of the list in pixels
Height of the list in pixels
String containing comma-separated list items
If true, the list will be sorted and remain sorted after adding elements

Related topics
XADlistadd, XADlistgetsel, XADlistshow

Fair Isaac Corporation Confidential and Proprietary Information

50

XAD objects reference

XADlistadd
PurposeAdd an item to a list
Synopsisprocedure XADlistadd(id:integer, item:string)Arguments
id
item

List identifier
Item to add

Further information
Appends the item to the list.
Related topics
XADlistgetsel, XADlistshow

Fair Isaac Corporation Confidential and Proprietary Information

51

XAD objects reference

XADlistgetsel
PurposeGet the selected item from a list.
Synopsisfunction XADlistgetsel(id:integer):stringArguments
id

List identifier

Return value
Selected item.
Further information
Obtains the item currently selected.
Related topics
XADlistadd, XADlistshow, XADlistselectFair Isaac Corporation Confidential and Proprietary Information

52

XAD objects reference

XADlistselectPurpose
Select a list item
Synopsisprocedure XADlistselect(id:integer, item:string)Arguments
id
item

List identifier
Item to selectFurther information
If found, selects the item.
Related topics
XADlistgetsel, XADlistshow

Fair Isaac Corporation Confidential and Proprietary Information

53

XAD objects reference

XADlistshow
PurposeShow a list.
Synopsisprocedure XADlistshow(id:integer, items:set)
Arguments
id
List identifier
items Items to display
Further information
Fills the list with the contents of the given set of items. Mosel will try to infer the type of the set
and display accordingly. For example showing a set of mpvar will display the solution values andreduced costs for each item.
Related topics
XADlistadd, XADlistgetsel

Fair Isaac Corporation Confidential and Proprietary Information

54

XAD objects reference

XADcreatedroplist
PurposeCreate a droplist object.
Synopsisprocedure XADcreatedroplist(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, name:string)procedure XADcreatedroplist(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, name:string, sorted:boolean)
Arguments
wid
id
x
y
w
h
name
sortedid of the window containing the droplist
Droplist identifier
x coordinate (from left of window) of the droplist in pixels
y coordinate (from top of window) of the droplist in pixels
Width of the droplist in pixels
Height of the droplist in pixels
String containing comma-separated droplist items
If true, the droplist will be sorted and remain sorted after adding elements

Related topics
XADdroplistadd, XADdroplistgetsel, XADdroplistshow

Fair Isaac Corporation Confidential and Proprietary Information

55

XAD objects reference

XADdroplistadd
PurposeAdd an item to a droplist
Synopsisprocedure XADdroplistadd(id:integer, item:string)Arguments
id
item

Droplist identifier
Item to add

Further information
Appends the item to the droplist.
Related topics
XADdroplistgetsel, XADdroplistshow

Fair Isaac Corporation Confidential and Proprietary Information

56

XAD objects reference

XADdroplistgetsel
PurposeGet the selected item from a droplist.
Synopsisfunction XADdroplistgetsel(id:integer):stringArguments
id

Droplist identifier

Return value
Selected item.
Further information
Obtains the item currently selected.
Related topics
XADdroplistadd, XADdroplistshow, XADdroplistselectFair Isaac Corporation Confidential and Proprietary Information

57

XAD objects reference

XADdroplistselectPurpose
Select a droplist item
Synopsisprocedure XADdroplistselect(id:integer, item:string)Arguments
id
item

Droplist identifier
Item to selectFurther information
If found, selects the item.
Related topics
XADdroplistgetsel, XADdroplistshow

Fair Isaac Corporation Confidential and Proprietary Information

58

XAD objects reference

XADdroplistshow
PurposeShow a droplist.
Synopsisprocedure XADdroplistshow(id:integer, items:set)
Arguments
id
Droplist identifier
items Items to display
Further information
Fills the droplist with the contents of the given set of items. Mosel will try to infer the type of the
set and display accordingly. For example showing a set of mpvar will display the solution values
and reduced costs for each item.
Related topics
XADdroplistadd, XADdroplistgetsel

Fair Isaac Corporation Confidential and Proprietary Information

59

XAD objects reference

XADcreateprogress
PurposeCreate a progress bar.
Synopsisprocedure XADcreateprogress(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer)
Arguments
wid
id
x
y
w
h

id of the window containing the progress
Progress identifier
x coordinate (from left of window) of the progress in pixels
y coordinate (from top of window) of the progress in pixels
Width of the progress in pixels
Height of the progress in pixels

Related topics
XADprogressset

Fair Isaac Corporation Confidential and Proprietary Information

60

XAD objects reference

XADprogressset
PurposeSet the progress state.
Synopsisprocedure XADprogressset(id:integer, minval:real, maxval:real,current:real)
Argumentsidminvalmaxvalcurrent

Progress identifier
Lower boundUpper boundCurrent value

Further information
The progress will show how far current is between minval and maxval.

Fair Isaac Corporation Confidential and Proprietary Information

61

XAD objects reference

XADcreatetab
PurposeCreate a tab selector object.
Synopsisprocedure XADcreatetab(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, tabset:set of string)procedure XADcreatetab(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, tabs:string)Arguments
wid
id
x
y
w
h
tabsettabs

id of the window containing the tab
Tab identifier
x coordinate (from left of window) of the tab in pixels
y coordinate (from top of window) of the tab in pixels
Width of the tab in pixels
Height of the tab in pixels
Set of strings containing the tab names
String containing an ordered, comma-separated list of tab names

Fair Isaac Corporation Confidential and Proprietary Information

62

XAD objects reference

XADtabgettab
PurposeGet the current tab selection.
Synopsisfunction XADtabgettab(id:integer):stringArgument
id

Tab identifier

Return value
Selected item.

Fair Isaac Corporation Confidential and Proprietary Information

63

XAD objects reference

XADtabsettab
Purpose
Select a given tab.
Synopsisprocedure XADtabsettab(id:integer, tab:string)Argumentsidtab

Tab identifier
tab to be selected

Fair Isaac Corporation Confidential and Proprietary Information

64

XAD objects reference

XADcreatemultilist
PurposeCreate a multilist object.
Synopsisprocedure XADcreatemultilist(wid:integer, id:integer, name:string,
x:integer, y:integer, w:integer, h:integer)
Arguments
wid
id
x
y
w
h

id of the window containing the multilist
Multilist identifier
x coordinate (from left of window) of the multilist in pixels
y coordinate (from top of window) of the multilist in pixels
Width of the multilist in pixels
Height of the multilist in pixels

Related topics
XADmultilistshow, XADmultilistsetsize, XADmultilistsetcolname,
XADmultilistsettext

Fair Isaac Corporation Confidential and Proprietary Information

65

XAD objects reference

XADmultilistshow
PurposeLoad and display multi-dimensional arrays or a set in a multilist.
Synopsisprocedure XADmultilistshow(id:integer, items:

array)

Arguments
id
Multilist identifier
items Comma-separated list of array names to display in the multilist, or just one array name.
ExampleXADmultilistshow(id_multi, "Units, Salesforce, NetProfit")
Further information
Clears the content of the multilist and fills it with the given array of items (integers, reals, strings,
booleans, mpvars or linctrs). If more than one array is given, they must have the exact same index
sets and shape.
Related topics
XADmultilistsetsize, XADmultilistsetcolname, XADmultilistsettext

Fair Isaac Corporation Confidential and Proprietary Information

66

XAD objects reference

XADmultilistsetsize
Purpose(Re)set the size of a multilist.
Synopsisprocedure XADmultilistsetsize(id:integer, rows:integer, columns:integer)
procedure XADmultilistsetsize(id:integer, rows:integer, columns:integer,
callback:string)Arguments
idrows
columns
callback

Multilist identifier
Number of rows
Number of columns
Name of callback function for requesting element values

Example 1
A static multilist

procedure SetUpStaticList
XADmultilistsetsize(id_multidynamic, 10000, 8)
forall(i in 1..8) XADmultilistsetcolname(id_multidynamic, i, "Col "+i)forall(i in 1..10000, j in 1..8) XADmultilistsettext(id_multidynamic, i, j, "XADmultilistrefresh(id_multidynamic)
end-procedure
Example 2
A dynamic multilist
function ElementGenerator(id:integer, row:integer, col:integer):string
returned:=""+row+","+col!Generate element based on row, colend-function
procedure SetUpDynamicList!Set up the multilist to ask for its items only when they are needed!a multilist with 10,000 rows and 8 columns which uses a callback
XADmultilistsetsize(id_multidynamic, 10000, 8, "ElementGenerator")!Column names
forall(i in 1..8) XADmultilistsetcolname(id_multidynamic, i, "Col "+i)end-procedure
Further information
Clears the content of the multilist and prepares to hold the given number of rows and columns.
Note that row and column indices start with 1.
Related topics
XADmultilistsetcolname, XADmultilistsettext

Fair Isaac Corporation Confidential and Proprietary Information

67

XAD objects reference

XADmultilistsetcolname
PurposeSet multilist column names.
Synopsisprocedure XADmultilistsetcolname(id:integer, column:integer, name:string)ArgumentsidcolumnnameMultilist identifier
Column index
Column name

Further information
The header of the column will display the new name.
Related topics
XADmultilistsetsize, XADmultilistsetcolname, XADmultilistrefresh

Fair Isaac Corporation Confidential and Proprietary Information

68

XAD objects reference

XADmultilistsettext
PurposeSet a multilist item.
Synopsisprocedure XADmultilistsettext(id:integer, row:integer, column:integer,
text:string)Argumentsidcolumnnametext

Multilist identifier
Column index
Column name
New text of the item

Further information
The item at the given row and column will hold the new text.
Related topics
XADmultilistsetsize, XADmultilistsetcolname, XADmultilistrefresh

Fair Isaac Corporation Confidential and Proprietary Information

69

XAD objects reference

XADmultilistgetsel
PurposeRetrieve the selected multilist item.
Synopsisprocedure XADmultilistgetsel(id:integer, list:set of integer)
Argumentsidlist

The id of the multilist object
The set of rows selected in the multilist

Related topics
XADmultilistsetsize, XADmultilistsetcolname, XADmultilistrefresh

Fair Isaac Corporation Confidential and Proprietary Information

70

XAD objects reference

XADmultilistsetcolors
PurposeSet the multilist item colour for a particular cell.
Synopsisprocedure XADmultilistsetcolors(id:integer, row:integer, column:integer,
bgcolour:integer, fgcolour:integer)
Argumentsidrow
columnbgcolourfgcolour

The id of the multilist object
The row of the cell to colour
The column of the cell to colour
The background colour as a 24bit colour value
The foreground colour as a 24bit colour value

Related topics
XADmultilistsetsize, XADmultilistsetcolname, XADmultilistrefresh

Fair Isaac Corporation Confidential and Proprietary Information

71

XAD objects reference

XADmultilistrefresh
PurposeUpdate the visual display (usually after many XADmultilistsettext operations).
Synopsisprocedure XADmultilistrefresh(id:integer)
Argument
id

Multilist identifier

Related topics
XADmultilistsetsize, XADmultilistsetcolname, XADmultilistsettext

Fair Isaac Corporation Confidential and Proprietary Information

72

XAD objects reference

XADcreatecanvas
PurposeCreate a canvas object.
Synopsisprocedure XADcreatecanvas(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer)
Arguments
wid
id
x
y
w
h

id of the window containing the canvas
Canvas identifier
x coordinate (from left of window) of the object in pixels
y coordinate (from top of window) of the object in pixels
Width of the object in pixels
Height of the object in pixels

Related topics
XADcanvasdrawbox, XADcanvasdrawellipse, XADcanvaserase, XADcanvasrefresh,
XADcanvasdrawimage, XADcanvassaveimage, XADcanvasdrawline, XADcanvasdrawpoint,
XADcanvasdrawrectangle, XADcanvasdrawtext, XADcanvasmap, XADcanvasunmap,
XADcolor

Fair Isaac Corporation Confidential and Proprietary Information

73

XAD objects reference

XADcanvasdrawbox
PurposeDraw a box on a canvas.
Synopsisprocedure XADcanvasdrawbox(id:integer, x:real, y:real, w:real, h:real,color1:integer, color2:integer)
Arguments
id
x
y
w
h
color1color2

Canvas identifier
x coordinate (from left of canvas)
y coordinate (from top of canvas)
width of box
height of box
Border color
Fill color

Further information
Draws a solid rectangle of color color2 with a one-pixel margin of color color1 of width w andheight h at coordinates (x,y).
Related topics
XADcanvasdrawline, XADcanvasdrawpoint, XADcanvasdrawrectangle,
XADcanvasdrawtext, XADcolor

Fair Isaac Corporation Confidential and Proprietary Information

74

XAD objects reference

XADcanvasdrawellipse
PurposeDraw an ellipse on a canvas.
Synopsisprocedure XADcanvasdrawellipse(id:integer, x:real, y:real, w:real, h:real,color1:integer, color2:integer)
Arguments
id
x
y
w
h
color1color2

Canvas identifier
x coordinate (from left of canvas)
y coordinate (from top of canvas)
width of ellipse
height of ellipse
Border color
Fill color

Further information
Draws a solid ellipse of color color2 with a one-pixel margin of color color1 of width w andheight h at coordinates (x,y).
Related topics
XADcanvasdrawline, XADcanvasdrawpoint, XADcanvasdrawrectangle,
XADcanvasdrawtext, XADcolor

Fair Isaac Corporation Confidential and Proprietary Information

75

XAD objects reference

XADcanvaserase
PurposeErase a canvas.
Synopsisprocedure XADcanvaserase(id:integer, color:integer)
Arguments
id
Canvas identifiercolor Color selection
Further information
Clears the contents of the canvas using the specified color
Related topics
XADcanvasrefresh

Fair Isaac Corporation Confidential and Proprietary Information

76

XAD objects reference

XADcanvasrefresh
PurposeRedraw a canvas.
Synopsisprocedure XADcanvasrefresh(id:integer)
Argument
id

Canvas identifier

Further information
Updates the visual content of the canvas. Simply drawing on a canvas does not update its
appearance (to save time). Only call XADcanvasrefresh when necessary.
Related topics
XADcanvaserase

Fair Isaac Corporation Confidential and Proprietary Information

77

XAD objects reference

XADcanvasdrawimage
PurposeDraw an image from file.
Synopsisprocedure XADcanvasdrawimage(id:integer, x:real, y:real, file: string)procedure XADcanvasdrawimage(id:integer, x:real, y:real, w:integer,
h:integer, file: string)Arguments
id
x
y
w
h
file

Canvas identifier
x coordinate
y coordinate
Width
HeightFile name

Further information
Draws the image from the given file at coordinates (x,y). The file can be of type .bmp, .jpg,.gif, or .png. If height and width are given, then the image is rescaled to fit in a rectangle ofwidth w and height h. If the string is "xadimg:imgname", a previously saved imgname (seeabove) will be drawn.
Related topics
XADcanvassaveimage

Fair Isaac Corporation Confidential and Proprietary Information

78

XAD objects reference

XADcanvassaveimage
PurposeSave an image to memory (to avoid loading a file repeatedly).
Synopsisprocedure XADcanvassaveimage(id:integer, x:real, y:real, w:integer,
h:integer, imgname: string)procedure XADcanvassaveimage(id:integer, filename:string, imgname: string)Arguments
id
x
y
w
h
filename
imgnameCanvas identifier
x coordinate
y coordinate
Width
HeightFile containing an image (.bmp, .jpg, .gif, or .png)
Image name

Further information
Saves what is currently drawn at x,y,w,h or the image in filename under the identifier imgname.
imgname can then be drawn anywhere else using XADcanvasdrawimage.
Related topics
XADcanvasdrawimage

Fair Isaac Corporation Confidential and Proprietary Information

79

XAD objects reference

XADcanvasdrawline
PurposeDraw a line on a canvas.
Synopsisprocedure XADcanvasdrawline(id:integer, x1:real, y1:real, x2:real, y2:real,color:integer)
procedure XADcanvasdrawline(id:integer, x1:real, y1:real, x2:real, y2:real,color:integer, width: integer)
Arguments
id
x1
y1
x2
y2
color
width

Canvas identifier
x start coordinate
y start coordinate
x end coordinate
y end coordinate
Color
Width

Further information
Draws a line width-pixels wide from (x1,y1) to (x2,y2) with the given color. The default width isone pixel.
Related topics
XADcanvasdrawbox, XADcanvasdrawpoint, XADcanvasdrawrectangle,
XADcanvasdrawtext, XADcolor

Fair Isaac Corporation Confidential and Proprietary Information

80

XAD objects reference

XADcanvasdrawpoint
PurposeDraw a point on a canvas.
Synopsisprocedure XADcanvasdrawpoint>(id:integer, x:real, y:real, color:integer)
Arguments
id
x
y
color

Canvas identifier
x coordinate
y coordinate
Color

Further information
Draws a pixel at (x,y) with the given color.
Related topics
XADcanvasdrawbox, XADcanvasdrawline, XADcanvasdrawrectangle, XADcanvasdrawtext,
XADcolor

Fair Isaac Corporation Confidential and Proprietary Information

81

XAD objects reference

XADcanvasdrawrectangle
PurposeDraw a rectangle on a canvas.
Synopsisprocedure XADcanvasdrawrectangle>(id:integer, x:real, y:real, w:real,
h:real, color:integer)
Arguments
id
x
y
w
h
color

Canvas identifier
x coordinate
y coordinate
Width
HeightColor

Further information
Draws a solid rectangle of width w and height h at coordinates (x,y) with the given color.
Related topics
XADcanvasdrawbox, XADcanvasdrawline, XADcanvasdrawpoint, XADcanvasdrawtext,
XADcolor

Fair Isaac Corporation Confidential and Proprietary Information

82

XAD objects reference

XADcanvasdrawpolygon
PurposeDraw a polygon on a canvas.
Synopsisprocedure XADcanvasdrawpolygon(id:integer, xs:array of real, ys:array ofreal, color1:integer, color2:integer)
Argumentsidxs
ys
color1color2

Canvas identifier
Array of x coordinates
Array of y coordinates
Border color
Fill color

Exampledeclarations
POINTS=1..3
xs,ys:array(POINTS) of real
end-declarations
xs::[50, 100, 30]
ys::[50, 200, 80]...
XADcanvasdrawpolygon(id_canvas,xs,ys,XAD_RED,XAD_BLACK)
Further information
Draws a using x and y coordinates taken from the xs and ys arrays. xs and ys must be indexed by
the same index set. See example.
Related topics
XADcanvasdrawbox, XADcanvasdrawline, XADcanvasdrawpoint, XADcanvasdrawtext,
XADcolor

Fair Isaac Corporation Confidential and Proprietary Information

83

XAD objects reference

XADcanvasdrawpie
PurposeDraw an elliptical pie slice on a canvas.
Synopsisprocedure XADcanvasdrawpie(id:integer, x:real, y:real, w:real, h:real,
start:real, end:real, color1:integer, color2:integer)
Arguments
id
x
y
w
h
start
end
color1color2

Canvas identifier
x coordinate
y coordinate
Width of bounding rectangle
Height of bounding rectangle
Clockwise start percentage [0-100]
Clockwise end percentage [0-100]
Border color
Fill color

Exampledeclarations
sizes: array(1..4) of realcolors: array(1..4) of integer
base: real
end-declarations
colors::[XAD_RED,XAD_GREEN,XAD_MAGENTA,XAD_BLACK]
forall(o in 1..4) sizes(o):=random*35; ! between 0-35%...

base:=0
forall(o in 1..4) do!circular pie
XADcanvasdrawpie(id_canvas,100,150,100,100,base,sizes(o),colors(o),colors(o))
base+=sizes(o)end-doFurther information
Draws a pie slice bounded by the given rectangle. The "angle" of the slice must be between[0-100] (percentage) and is measured clockwise beginning at 12 o’clock. See example.
Related topics
XADcanvasdrawbox, XADcanvasdrawarc, XADcanvasdrawchord

Fair Isaac Corporation Confidential and Proprietary Information

84

XAD objects reference

XADcanvasdrawarc
PurposeDraw an elliptical arc on a canvas.
Synopsisprocedure XADcanvasdrawarc(id:integer, x:real, y:real, w:real, h:real,
start:real, end:real, color:integer)
Arguments
id
x
y
w
h
start
end
color1

Canvas identifier
x coordinate
y coordinate
Width of bounding rectangle
Height of bounding rectangle
Clockwise start percentage [0-100]
Clockwise end percentage [0-100]
Color

Further information
Draws an elliptical arc bounded by the given rectangle. The "angle" of the arc must be between[0-100] (percentage) and is measured clockwise beginning at 12 o’clock.
Related topics
XADcanvasdrawbox, XADcanvasdrawpie, XADcanvasdrawchord

Fair Isaac Corporation Confidential and Proprietary Information

85

XAD objects reference

XADcanvasdrawchord
PurposeDraw an elliptical chord on a canvas.
Synopsisprocedure XADcanvasdrawchord(id:integer, x:real, y:real, w:real, h:real,
start:real, end:real, color1:integer, color2:integer)
Arguments
id
x
y
w
h
start
end
color1color2

Canvas identifier
x coordinate
y coordinate
Width of bounding rectangle
Height of bounding rectangle
Clockwise start percentage [0-100]
Clockwise end percentage [0-100]
Border color
Fill color

Exampledeclarations
sizes: array(1..4) of realcolors: array(1..4) of integer
base: real
end-declarations
colors::[XAD_RED,XAD_GREEN,XAD_MAGENTA,XAD_BLACK]
forall(o in 1..4) sizes(o):=random*35; ! between 0-35%...

base:=0
forall(o in 1..4) do!circular pie
XADcanvasdrawchord(id_canvas,100,150,100,100,base,sizes(o),colors(o),colors(obase+=sizes(o)end-doFurther information
Draws a elliptical chord bounded by the given rectangle. The "angle" of the chord must be
between [0-100] (percentage) and is measured clockwise beginning at 12 o’clock. See example.
Related topics
XADcanvasdrawbox, XADcanvasdrawarc, XADcanvasdrawpie

Fair Isaac Corporation Confidential and Proprietary Information

86

XAD objects reference

XADcanvasdrawtext
PurposeDraw text on a canvas.
Synopsisprocedure XADcanvasdrawtext(id:integer, x:real, y:real, text:string,color:integer)
procedure XADcanvasdrawtext(id:integer, x:real, y:real, text:string,color:integer, fontsize:integer, alignment:integer, fontname:string)Arguments
id
x
y
text
color
fontsizealignment
fontname

Canvas identifier
x coordinate
y coordinate
Text
Color
Font size
Vertical and horizontal alignment
Font name

Further information
Draws text with font fontname of size fontsize at coordinates (x,y) with the given color andalignment. If font name and size are not given then the output uses Arial 10pt. The alignment is
the sum of one of XAD_CENTERH, XAD_LEFT, and XAD_RIGHT (horizontal alignment) plus one of
XAD_CENTERV, XAD_TOP, and XAD_BOTTOM (vertical alignment). XAD_DEFAULT can be usedinstead to specify upper left alignment.
Related topics
XADcanvasdrawbox, XADcanvasdrawline, XADcanvasdrawpoint,
XADcanvasdrawrectangle, XADcolor

Fair Isaac Corporation Confidential and Proprietary Information

87

XAD objects reference

XADcanvasmap
PurposeMap the coordinate space of a canvas.
Synopsisprocedure XADcanvasmap(id:integer, x1:real, y1:real, x2:real, y2:real,x1new:real, y1new:real, x2new:real, y2new:real)
Arguments
id
x1
y1
x2
y2
x1new
y1new
x2new
y2new

Canvas identifier
x start coordinate
y start coordinate
x end coordinate
y end coordinate
New x start coordinate
New y start coordinate
New x end coordinate
New y end coordinate

Further information
Transforms the coordinate space of the canvas. Normally, (0,0) represents the upper left corner ofthe canvas and widths and heights are measured in pixels. By remapping the coordinate space,transformations no longer need to be applied to coordinates when drawing. For example, if thecanvas has a width of 300 and a height of 200 and if we want to draw a graph from -1 to +1 on
the x axis and -2 to +2 on the y axis in a region of the original canvas, we could write, say:
XADcanvasmap(id_canvas, 50, 150, 250, 50, -1, -2, 1, 2)
before plotting the points on the graph. Note that this transformation reverts the direction of
the y axis and plots everything between (-1,1) and (-2,2) in the portion of the canvas between
pixel coordinates (50,50) and (250,150). The following figure clarifies the effect of the
XADcanvasmap call:

After calling this procedure, coordinates should be given in the red intervals. XAD will map themcorrectly onto the canvas, based on the black intervals.
Related topics
XADcanvasunmap

Fair Isaac Corporation Confidential and Proprietary Information

88

XAD objects reference

XADcanvasunmap
Purpose
Revert to default mapping for a canvas.
Synopsisprocedure XADcanvasunmap(id:integer)
Argument
id

Canvas identifier

Further information
Reverts to default mapping of coordinates
Related topics
XADcanvasmap

Fair Isaac Corporation Confidential and Proprietary Information

89

XAD objects reference

XADcolor
PurposeCreate a color value.
Synopsisfunction XADcolor(red:real, green:real, blue:real):integer
Arguments
red
Intensity of red (between 0 and 255)
green Intensity of green (between 0 and 255)
blue Intensity of blue (between 0 and 255)
Return value
Color value.
Further information
Creates a color value based on intensities of red, green and blue.
Related topics
See Section 5.3 for a list of predefined color constants.

Fair Isaac Corporation Confidential and Proprietary Information

90

XAD objects reference

XADcreatebrowser
PurposeCreate a browser.
Synopsisprocedure XADcreatebrowser(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, url:string)Arguments
wid
id
x
y
w
h
url

id of the window containing the browser
Browser identifier
x coordinate (from left of window) of the browser in pixels
y coordinate (from top of window) of the browser in pixels
Width of the browser in pixels
Height of the browser in pixels
URL to open when the object is createdRelated topics
XADbrowsergoto

Fair Isaac Corporation Confidential and Proprietary Information

91

XAD objects reference

XADbrowsergoto
PurposeOpen the given URL in the browser.
Synopsisprocedure XADbrowsergoto(id:integer, url:string)Arguments
idurl

Browser identifier
The URL to visit.

Further information
Visits the given url.
Related topics
XADcreatebrowser

Fair Isaac Corporation Confidential and Proprietary Information

92

XAD objects reference

XADbrowsergetmessage
PurposeReturns the query string of the last HTTP POST from within the browser object to the action URL"xad://"
Synopsisprocedure XADbrowsergetmessage(id:integer)
Argument
id

Browser identifier

Related topics
XADcreatebrowser XAD_BROWSER_MESSAGE

Fair Isaac Corporation Confidential and Proprietary Information

93

XAD objects reference

XADbrowsergetvalue
PurposeReturns the value of a field from the last HTTP POST from within the browser object to the action
URL "xad://"Synopsisprocedure XADbrowsergetvalue(id:integer, fieldname:string)Argumentsidfieldname

Browser identifier
The name of the field of the HTTP POST to return

Related topics
XADcreatebrowser XADbrowsergetmessage XAD_BROWSER_MESSAGE

Fair Isaac Corporation Confidential and Proprietary Information

94

XAD objects reference

XADcreatescrollbar
PurposeCreate a scrollbar object.
Synopsisprocedure XADcreatescrollbar(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer, vertical:boolean)
Arguments
wid
id
x
y
w
h
vertical

id of the window containing the scrollbar
Scrollbar identifier
x coordinate (from left of window) of the scrollbar in pixels
y coordinate (from top of window) of the scrollbar in pixels
Width of the scrollbar in pixels
Height of the scrollbar in pixels
true=vertical; false=horizontal

Related topics
XADscrollbarset, XADscrollbargetpos

Fair Isaac Corporation Confidential and Proprietary Information

95

XAD objects reference

XADscrollbargetpos
PurposeObtain the current position of the scrollbar.
Synopsisfunction XADscrollbargetpos(id:integer):integer
Argument
id

Scrollbar identifier

Return value
Current scrollbar position.
Related topics
XADcreatescrollbar, XADscrollbarset

Fair Isaac Corporation Confidential and Proprietary Information

96

XAD objects reference

XADscrollbarset
PurposeSet scrollbar characteristics.
Synopsisprocedure XADscrollbarset(id:integer, minimum:integer, maximum:integer,
pagesize:integer, position:integer)
Argumentsidminimum
maximum
pagesize
position

Scrollbar identifier
Minimum value for scrollbar
Maximum value for scrollbar
Size of one "page" (clicking in the scrollbar advances one page at a time)
Initial position of the scrollbar

Related topics
XADcreatescrollbar, XADscrollbargetpos

Fair Isaac Corporation Confidential and Proprietary Information

97

XAD objects reference

XADcreatetree
PurposeCreate a tree object.
Synopsisprocedure XADcreatetree(wid:integer, id:integer, x:integer, y:integer,
w:integer, h:integer)
Arguments
wid
id
x
y
w
h

id of the window containing the tree
Tree identifier
x coordinate (from left of window) of the tree in pixels
y coordinate (from top of window) of the tree in pixels
Width of the tree in pixels
Height of the tree in pixels

Related topics
XADtreeadd, XADtreereset, XADtreeexpand

Fair Isaac Corporation Confidential and Proprietary Information

98

XAD objects reference

XADtreeadd
PurposeAdd a branch to a tree
Synopsisprocedure XADtreeadd(id:integer, parent:string, items:
Argumentsidparentitems

set of string)

Tree identifier
Parent branch identifier (single string or comma-separated strings for deeper items)
Items to show when parent is expanded

ExampleXADtreeadd(id_tree, "January", {"New York","London","Paris"})
XADtreeadd(id_tree, "February", {"New York","London","Paris"})
XADtreeadd(id_tree, "January,New York", {"Rainfall","Snowfall"})

Further information
Add a branch to the tree. If the parent is a single string, it is added as a root item. Then all theitems are added as its children. If the parent is string consisting of comma separated names, XAD
will travel down the tree until it finds the corresponding node. Then all the items are added as its
children.
Related topics
XADcreatetree, XADtreereset, XADtreeexpand

Fair Isaac Corporation Confidential and Proprietary Information

99

XAD objects reference

XADtreereset
PurposeClears the content of a tree
Synopsisprocedure XADtreereset(id:integer)
Argument
id

Tree identifier

Related topics
XADcreatetree, XADtreeadd, XADtreeexpand

Fair Isaac Corporation Confidential and Proprietary Information

100

XAD objects reference

XADtreeexpand
PurposeExpands a tree branch .
Synopsisprocedure XADtreeexpand(id:integer, parent:string)ArgumentsidparentTree identifier
Branch identifier (single string or comma-separated strings for deeper items)

Related topics
XADcreatetree, XADtreeadd, XADtreereset

Fair Isaac Corporation Confidential and Proprietary Information

101

XAD objects reference

5.19

Events specific to objects
XAD_BROWSER_MESSAGE

Browser event message

p. 102

XAD_EVENT_CHANGED

Input, editor or scrollbar changed event.

p. 104

XAD_EVENT_MENU

Menu event.

p. 102

XAD_EVENT_PRESSED

Button pressed event.

p. 104

XAD_EVENT_SELECTION

Selection event.

p. 104

XAD_EVENT_TIMER

Timer event.

p. 102

XAD_EVENT_WINDOW_CLOSEDWindow closed event.

p. 103

XAD_EVENT_WINDOW_CLOSING

Window closing event.

p. 103

XAD_EVENT_WINDOW_HIDDEN

Window hidden event.

p. 103

XAD_EVENT_WINDOW_MOVED

Window moved event.

p. 103

XAD_EVENT_WINDOW_OPENEDWindow opened event.

p. 103

XAD_EVENT_WINDOW_RESIZEDWindow resized event.

p. 103

XAD_EVENT_WINDOW_SHOWN

Window shown event.

p. 104

XAD_BROWSER_MESSAGE
Description

Browser event message

Note

Event indicating that the browser object has initiated an HTTP POST event to the URL"xad://". Use XADbrowsergetvalue to interrogate the posted data.

XAD_EVENT_MENU
Description

Menu event.

Note

Event generated when a menu item is selected.

XAD_EVENT_TIMER
Description

Timer event.

NoteTimer event associated with window objects. See XADwindowsettimer

Fair Isaac Corporation Confidential and Proprietary Information

102

XAD objects reference

XAD_EVENT_WINDOW_CLOSED
Description

Window closed event.

Note

Event generated when a window was closed using XADwindowclose or by the user.

XAD_EVENT_WINDOW_CLOSING
Description

Window closing event.

Note

Event generated when a window is about to be closed. May be overriden by calling
XADwindowkeep.

XAD_EVENT_WINDOW_HIDDEN
Description

Window hidden event.

Note

Event generated when a window was hidden using XADwindowhide or by the user.

XAD_EVENT_WINDOW_MOVED
Description

Window moved event.

Note

Event generated when the window position has changed.

XAD_EVENT_WINDOW_OPENED
Description

Window opened event.

Note

Crucial event in the lifetime of a window opened using XADwindowopen. Perform all
object initializations when this event is received.

XAD_EVENT_WINDOW_RESIZED
Description

Window resized event.

Note

Event generated when a window is resized by the user. Capture this event in order toupdate the positions and sizes of objects in the window, using XADsetpos.

Fair Isaac Corporation Confidential and Proprietary Information

103

XAD objects reference

XAD_EVENT_WINDOW_SHOWN
Description

Window shown event.

Note

Event generated when a window is shown as a result of calling XADwindowshow.
Perform all object initializations when this event is received

XAD_EVENT_PRESSED
Description

Button pressed event.

Note

Event generated by regular button objects, check buttons, or radio buttons.

XAD_EVENT_CHANGED
Description

Input, editor or scrollbar changed event.

Note

Event indicating that the text in an input or editor object has changed, or that theposition of a scrollbar has changed.

XAD_EVENT_SELECTION
Description

Selection event.

Note

Event indicating that the selection has changed in a list, droplist, or tab object.

Fair Isaac Corporation Confidential and Proprietary Information

104

C HAPTER 6

XAD object groups reference
XAD provides functionality to work with groups of objects, quickly allowing multiple objects tobe moved, hidden or disabled. This can, for instance, greatly simplify the code required to
implement functioning Tab (5.14) objects.

6.1

Group Basics
Unlike the Group (5.7) object which is simply a graphical display, groups are actual collections oflinked objects which may be moved, hidden or enabled in unison. An object may belong tomultiple groups, but it is important to remember that in these cases the state of the object will
depend on the last group command called. For instance if you were to disable a group of objects
which consisted of objects A, B and C; then enable a second group containing objects B, D and E,
you would find that objects A and C would be disabled, but that B, D and E would all be enabled.
Groups created via XADgroupcreate may be referred to directly via the returned group id;
however, groups created when loading resources (XADloadresource) must first have their ids
retrieved using XADgroupgetid before operations can be performed upon them.

Specific subroutines
XADgroupcreate, XADgroupaddmember XADgroupdisband XADgroupremovemember
XADgroupgetid XADgroupgeth XADgroupgetw XADgroupgetx XADgroupgety
XADgroupsetpos XADgroupsetvisible XADgroupenable
Specific events
None

6.2

Subroutines specific to groups
XADgroupaddmember

Add an object to an already existing group

p. 108XADgroupcreate

Create a group from a list of object ids

p. 107

XADgroupdisband

Disband/destroy a group of objects

p. 109XADgroupenable

Enable or disable the objects within the group

p. 118XADgroupgeth

Find the height of the region enclosing all the objects in thegroup
p. 112

XADgroupgetid

Retrieve the group id by name and window id

XADgroupgetw

Find the width of the region enclosing all the objects in the group
p. 113

Fair Isaac Corporation Confidential and Proprietary Information

p. 111

105

XAD object groups reference

XADgroupgetx

Find the x-position of the start of the region enclosing all theobjects in the group
p. 114

XADgroupgety

Find the y-position of the start of the region enclosing all theobjects in the group
p. 115

XADgroupremovemember

Remove an object from a group

XADgroupsetpos

Move the group objects to a new position (keeping all objects in
the group at the same relative positions)p. 116

XADgroupsetvisble

Hide or show the objects within the group

Fair Isaac Corporation Confidential and Proprietary Information

p. 110p. 117

106

XAD object groups reference

XADgroupcreate
PurposeCreate a group from a list of object ids
Synopsisfunction XADgroupcreate(ids:
Argumentids

set of integer):integer

An integer set of object ids for those objects you wish to place in the group

Return value
The group id of the created group.
Related topics
XADgroupaddmember, XADgroupremovemember, XADgroupdisband

Fair Isaac Corporation Confidential and Proprietary Information

107

XAD object groups reference

XADgroupaddmember
PurposeAdd an object to an already existing group
Synopsisprocedure XADgroupaddmember(groupid:

integer, objectid:

integer)

Argumentsgroupid
An integer id of the group you wish to add toobjectid An integer object id of the object you wish to place in the group
Related topics
XADgroupcreate, XADgroupremovemember, XADgroupdisband

Fair Isaac Corporation Confidential and Proprietary Information

108

XAD object groups reference

XADgroupdisband
Purpose
Disband/destroy a group of objects
Synopsisprocedure XADgroupdisband(id:Argument
id

integer)

The id of the group you wish to disband.

Related topics
XADgroupcreate, XADgroupaddmember, XADgroupremovemember

Fair Isaac Corporation Confidential and Proprietary Information

109

XAD object groups reference

XADgroupremovemember
PurposeRemove an object from a group
Synopsisprocedure XADgroupremovemember(groupid:

integer, objectid:

integer)

Argumentsgroupid
The group id to remove the object fromobjectid The id of the object to remove from the group
Related topics
XADgroupcreate, XADgroupaddmember, XADgroupdisband

Fair Isaac Corporation Confidential and Proprietary Information

110

XAD object groups reference

XADgroupgetid
PurposeRetrieve the group id by name and window id
Synopsisfunction XADgroupgetid(name:string, windowid:

integer):integer

Arguments
name

The name given to the group when creating the resource loaded via
XADloadresource
windowid The id of the window object created when loading the resource containing thegroup definition

Return value
The id of the given group, or -1 if no such group exists.
Related topics
XADloadresource

Fair Isaac Corporation Confidential and Proprietary Information

111

XAD object groups reference

XADgroupgeth
PurposeFind the height of the region enclosing all the objects in the group
Synopsisfunction XADgroupgeth(id:Argument
id

integer):integer

The id of the group to retrieve the height ofReturn value
The height of the group region.
Related topics
XADgroupcreate, XADgroupgetw, XADgroupgetx, XADgroupgety

Fair Isaac Corporation Confidential and Proprietary Information

112

XAD object groups reference

XADgroupgetw
PurposeFind the width of the region enclosing all the objects in the group
Synopsisfunction XADgroupgetw(id:Argument
id

integer):integer

The id of the group to retrieve the width of

Return value
The width of the group region.
Related topics
XADgroupcreate, XADgroupgeth, XADgroupgetx, XADgroupgety

Fair Isaac Corporation Confidential and Proprietary Information

113

XAD object groups reference

XADgroupgetx
PurposeFind the x-position of the start of the region enclosing all the objects in the group
Synopsisfunction XADgroupgetx(id:Argument
id

integer):integer

The id of the group to retrieve the x-position

Return value
The x-position of the group region.
Related topics
XADgroupcreate, XADgroupgeth, XADgroupgetw, XADgroupgety

Fair Isaac Corporation Confidential and Proprietary Information

114

XAD object groups reference

XADgroupgety
PurposeFind the y-position of the start of the region enclosing all the objects in the group
Synopsisfunction XADgroupgety(id:Argument
id

integer):integer

The id of the group to retrieve the y-position

Return value
The y-position of the group region.
Related topics
XADgroupcreate, XADgroupgeth, XADgroupgetw, XADgroupgetx

Fair Isaac Corporation Confidential and Proprietary Information

115

XAD object groups reference

XADgroupsetpos
PurposeMove the group objects to a new position (keeping all objects in the group at the same relative
positions)
Synopsisprocedure XADgroupsetpos(groupid:
ypos:integer):integer

integer, xpos:

integer,

Argumentsgroupid The id of the group to move
xpos
The x-position to move the group region toypos
The y-position to move the group region to
Related topics
XADgroupcreate, XADgroupgetx, XADgroupgety

Fair Isaac Corporation Confidential and Proprietary Information

116

XAD object groups reference

XADgroupsetvisble
PurposeHide or show the objects within the group
Synopsisprocedure XADgroupsetvisible(id:Argumentsidshow

integer, show:boolean)

The id of the group to show/hide
If true the objects within the group are shown, if false they are hidden

Related topics
XADgroupcreate, XADgroupenable, XADgroupsetpos

Fair Isaac Corporation Confidential and Proprietary Information

117

XAD object groups reference

XADgroupenable
PurposeEnable or disable the objects within the group
Synopsisprocedure XADgroupenable(id:Argumentsidenableinteger, enable:boolean)

The id of the group to enable/disable
If true the objects within the group are enabled, if false they are disabled

Related topics
XADgroupcreate, XADgroupsetvisible, XADgroupsetpos

Fair Isaac Corporation Confidential and Proprietary Information

118

C HAPTER 7

Generic routines
XADdestroy

Delete an object.

p. 120

XADenable

Enable/disable user interaction.

p. 121XADgeteventtext

Retrieve the message associated with an event.

p. 136

XADgethGet the height of an object.

p. 127

XADgetid

Get the id of an object.

p. 128XADgetmousex

Get the x coordinate of the mouse cursor relative to an object.

p. 122XADgetmousey

Get the y coordinate of the mouse cursor relative to an object.

p. 123XADgetwGet the width of an object.

p. 126

XADgetx

Get the x coordinate of an object.

p. 124

XADgety

Get the y coordinate of an object.

p. 125

XADloadresource

Load a resource file as a XAD window.

p. 129XADrefresh

Refresh an object.

p. 130

XADsetfocus

Focus on an object

p. 131XADsetname

Set or change the name of an object

p. 132

XADsetpos

Reposition an object.

p. 133

XADsettext(Re)set the textual information of an object.

p. 134

XADsetvisible

Making an object visible/hidden.

p. 135

Fair Isaac Corporation Confidential and Proprietary Information

119Generic routines

XADdestroy
PurposeDelete an object.
Synopsisprocedure XADdestroy(id:integer)
Argument
id

Object identifier

Further information
When an object is no longer needed, it can be destroyed. Once destroyed, its id can no longer be
used. However, a new object can be created with the same id.

Fair Isaac Corporation Confidential and Proprietary Information

120

Generic routines

XADenable
PurposeEnable/disable user interaction.
Synopsisprocedure XADenable(id:integer, state:boolean)
Arguments
id
Object identifier
state
true
enable user interaction with the object
false
disable user interaction with the object
Further information
Used to enable/disable user interaction with the object. For example, a Save button should
probably be disabled if there is nothing to save.

Fair Isaac Corporation Confidential and Proprietary Information

121Generic routines

XADgetmousex
PurposeGet the x coordinate of the mouse cursor relative to an object.
Synopsisfunction XADgetmousex(id:integer):integer
Argument
id

Object identifier

Return value
x coordinate of the mouse cursor, relative to the object.
Further information
This function returns the x coordinate (in pixels) of the mouse cursor, relative to the upper left
corner of the object specified.
Related topics
XADgetmousey

Fair Isaac Corporation Confidential and Proprietary Information

122Generic routines

XADgetmousey
PurposeGet the y coordinate of the mouse cursor relative to an object.
Synopsisfunction XADgetmousey(id:integer):integer
Argument
id

Object identifier

Return value
y coordinate of the mouse cursor, relative to the object.
Further information
This function returns the y coordinate (in pixels) of the mouse cursor, relative to the upper left
corner of the object specified.
Related topics
XADgetmousex

Fair Isaac Corporation Confidential and Proprietary Information

123Generic routines

XADgetx
PurposeGet the x coordinate of an object.
Synopsisfunction XADgetx(id:integer):integer
Argument
id

Object identifier

Return value
x coordinate value of the object.
Further information
This function returns the x coordinate (in pixels) of the object id relative to the upper left cornerof the window containing it. If id refers to a window, it returns the coordinate relative to thescreen.
Related topics
XADgety, XADgeth, XADgetw

Fair Isaac Corporation Confidential and Proprietary Information

124Generic routines

XADgety
PurposeGet the y coordinate of an object.
Synopsisfunction XADgety(id:integer):integer
Argument
id

Object identifier

Return value
y coordinate value of the object.
Further information
This function returns the y coordinate (in pixels) of the object id relative to the upper left cornerof the window containing it. If id refers to a window, it returns the coordinate relative to thescreen.
Related topics
XADgetx, XADgeth, XADgetw

Fair Isaac Corporation Confidential and Proprietary Information

125Generic routines

XADgetwPurposeGet the width of an object.
Synopsisfunction XADgetw(id:integer):integer
Argument
id

Object identifier

Return value
Width of the object.
Further information
This function returns the width (in pixels) of the object. If the identifier id represents a window,
and its value is negative (e.g. -1000000000), then the inner width of the window is returned. This
represents the ’useable’ space of a window, as it excludes borders, menus, titles, etc.
Related topics
XADgeth, XADgetx, XADgety

Fair Isaac Corporation Confidential and Proprietary Information

126Generic routines

XADgethPurposeGet the height of an object.
Synopsisfunction XADgeth(id:integer):integer
Argument
id

Object identifier

Return value
Height of the object.
Further information
This function returns the height (in pixels) of the object. If the identifier id represents a window,
and its value is negative (e.g. -1000000000), then the inner height of the window is returned. This
represents the ’useable’ space of a window, as it excludes borders, menus, titles, etc.
Related topics
XADgetw, XADgetx, XADgety

Fair Isaac Corporation Confidential and Proprietary Information

127Generic routines

XADgetid
PurposeGet the id of an object.
Synopsisfunction XADgetid(name:string, windowid:integer):integer
Arguments
nameObject name as set in the resource file, or via XADsetname.
windowid The id of the window the object belongs to.
Return value
The id of the object.
Further information
Related topics
XADloadresource, XADgetw, XADgetx, XADgety

Fair Isaac Corporation Confidential and Proprietary Information

128Generic routines

XADloadresource
PurposeLoad a resource file as a XAD window.
Synopsisfunction XADloadresource(file:Argument
file

string):integer

The name of the resource file to load

Return value
The window id of the newly created XAD window object.
Further information
The resource file is an XML-like file created by the IVE XAD editor and is used to quickly create a
XAD window and associated objects. The various ids for the objects may be retrieved using
XADgetid.
Related topics
XADgetid, XADgroupgetid, XADsetname

Fair Isaac Corporation Confidential and Proprietary Information

129Generic routines

XADrefresh
PurposeRefresh an object.
Synopsisprocedure XADrefresh(id:integer)
Argument
id

Object identifier

Further information
If an object may not be painted correctly due to a complex layout operation, use this routine to
update its appearance.

Fair Isaac Corporation Confidential and Proprietary Information

130Generic routines

XADsetfocus
Purpose
Focus on an object
Synopsisprocedure XADsetfocus(id:integer)
Argument
id

Object identifier

Further information
The target object will receive the keyboard focus.

Fair Isaac Corporation Confidential and Proprietary Information

131Generic routines

XADsetname
PurposeSet or change the name of an object
Synopsisprocedure XADsetname(id:integer, name:Argumentsid
namestring)Object identifier
The name to give the object

Further information
Objects loaded via a resource will have names set from the resource file. Objects constructed via
code will not have names and so you can set them with this routine if you desire (to allow use of
the non-generic event callbacks normally generated by the IVE XAD editor event dialog). Be
careful if altering the names of objects created and loaded via a resource file; any event callbacks
created by the IVE XAD editor event dialog will not be called if the names of the objects arechanged.
Related topics
XADloadresource

Fair Isaac Corporation Confidential and Proprietary Information

132

Generic routines

XADsetpos
PurposeReposition an object.
Synopsisprocedure XADsetpos(id:integer, x:integer, y:integer, w:integer, h:integer)
Arguments
id
x
y
w
h

Object identifier
x coordinate
w coordinate
Width
HeightFurther information
This procedure repositions the object id. Note: use the XADget* routines to leave parameters
unchanged.
Related topics
XADgeth, XADgetw, XADgetx, XADgety

Fair Isaac Corporation Confidential and Proprietary Information

133

Generic routines

XADsettext
Purpose(Re)set the textual information of an object.
Synopsisprocedure XADsettext(id:integer, text:string)Arguments
id
text

Object identifier
New textual information

Further information
This procedure updates the textual information of an object if applicable.

Fair Isaac Corporation Confidential and Proprietary Information

134Generic routines

XADsetvisible
PurposeMaking an object visible/hidden.
Synopsisprocedure XADsetvisible(id:integer, visible:boolean)
Arguments
id
Object identifier
visible Display option.
true
object visible
false
object hidden
Further information
Objects may be shown or hidden by calling this procedure.

Fair Isaac Corporation Confidential and Proprietary Information

135Generic routines

XADgeteventtext
PurposeRetrieve the message associated with an event.
Synopsisfunction XADgeteventtext:string
Return value
The event message or an empty string.
Further information
If an event carries textual information (for example a tab selection), use this function to retrieve
the text when handling the event.
Related topics
XAD_EVENT_CHANGED, XAD_EVENT_SELECTION, XAD_EVENT_KEYDOWN, XAD_EVENT_KEYUP

Fair Isaac Corporation Confidential and Proprietary Information

136

C HAPTER 8

Generic events
XAD_EVENT_KEYDOWN

Key pressed.

p. 137

XAD_EVENT_KEYUP

Key released.

p. 138

XAD_EVENT_MOUSE_LEFTDBCLK

Double click with left mouse button.

p. 138

XAD_EVENT_MOUSE_LEFTDOWN

Left mouse button pressed.

p. 138

XAD_EVENT_MOUSE_LEFTUP

Left mouse button released.

p. 138

XAD_EVENT_MOUSE_MOVED

Mouse moved.

p. 138

XAD_EVENT_MOUSE_RIGHTDBCLK

Double click with right mouse button.

p. 139

XAD_EVENT_MOUSE_RIGHTDOWN

Right mouse button pressed.

p. 139

XAD_EVENT_MOUSE_RIGHTUP

Right mouse button released.

p. 139

XAD_EVENT_KEYDOWN
Description

Key pressed.

Note

Indicates that a key was pressed when the object had the focus. Call XADgeteventtext
to obtain the representation of the key that was pressed. Letters and digits are returned
as themselves. The following special codes can also be returned:
Up arrow"up"
Down arrow "down"
Left arrow"left"
Right arrow"right"
Tab
"tab"
Enter
"enter"Shift"shift"Ctrl"control"Caps Lock"capslock"
Esc
"esc"
Spacebar" "Page Up"pageup"
Page Down"pagedown"
End
"end"
Home
"home"
Insert"ins"
Delete"del"Fair Isaac Corporation Confidential and Proprietary Information

137

Generic events

XAD_EVENT_KEYUP
Description

Key released.

Note

Indicates that a key was released when the object had the focus. See
XAD_EVENT_KEYDOWN for more information.

XAD_EVENT_MOUSE_LEFTDBCLK
Description

Double click with left mouse button.

Note

Indicates that the left mouse button was double clicked above the object. When a user
double clicks, the following messages are generated by Windows, in this exact sequence:
XAD_EVENT_MOUSE_LEFTDOWN
XAD_EVENT_MOUSE_LEFTUP
XAD_EVENT_MOUSE_LEFTDBLCLK
XAD_EVENT_MOUSE_LEFTUP

XAD_EVENT_MOUSE_LEFTDOWN
Description

Left mouse button pressed.

Notes

Indicates that the left mouse button was pressed above the object. The coordinates ofthe mouse relative to ANY object id can be obtained ANYTIME using XADgetmousex
and XADgetmousey.
When double clicking on an object the second click is interpreted by Windows as ‘leftbutton double click’.

See also

XAD_EVENT_MOUSE_LEFTDBLCLK

XAD_EVENT_MOUSE_LEFTUP
Description

Left mouse button released.

Note

Indicates that the left mouse button was released above the object.

See also

XAD_EVENT_MOUSE_LEFTDOWN, XAD_EVENT_MOUSE_LEFTDBLCLK

XAD_EVENT_MOUSE_MOVED
Description

Mouse moved.

Note

Indicates that the mouse has moved above the object.

Fair Isaac Corporation Confidential and Proprietary Information

138

Generic events

XAD_EVENT_MOUSE_RIGHTDBCLK
Description

Double click with right mouse button.

Note

Indicates that the right mouse button was double clicked above the object. When a user
double clicks, the following messages are generated by Windows, in this exact sequence:
XAD_EVENT_MOUSE_RIGHTDOWN
XAD_EVENT_MOUSE_RIGHTUP
XAD_EVENT_MOUSE_RIGHTDBLCLK
XAD_EVENT_MOUSE_RIGHTUP

XAD_EVENT_MOUSE_RIGHTDOWN
Description

Right mouse button pressed.

Note

Indicates that the right mouse button was pressed above the object. When double
clicking on an object the second click is interpreted by Windows as ‘right button double
click’.

See also

XAD_EVENT_MOUSE_RIGHTDBLCLK

XAD_EVENT_MOUSE_RIGHTUP
Description

Right mouse button released.

Note

Indicates that the right mouse button was released above the object.

See also

XAD_EVENT_MOUSE_RIGHTDBLCLK, XAD_EVENT_MOUSE_RIGHTDOWN

Fair Isaac Corporation Confidential and Proprietary Information

139

C HAPTER 9

Utility routines
XADchoosefile

Display file selection dialog.

p. 145XADgetdesktopheight Gets the height of the primary monitor’s desktop

p. 149

Gets the width of the primary monitor’s desktop

p. 148XADgetdesktopwidth

XADgetsystemmetrics Gets the given Windows system metrics value
XADgetvirtualscreenheight

Gets the height of the primary monitor’s virtual screen

XADgetvirtualscreenwidth Gets the width of the virtual screenp. 147
p. 151
p. 150

XADgetvirtualscreenx

Gets the x-coordinate of the virtual screenp. 152XADgetvirtualscreeny

Gets the y-coordinate of the virtual screenp. 153XADhandleevents

Handling events during program execution.

p. 144

XADid

Obtain a unique identifier to represent objects.

p. 141

XADpopupmenu

Creation of a pop-up menu.

p. 146

XADsavescreenshot

Take a screenshot of an object and save it to a file.

p. 142

XADseteventcallback Set the event handler callback

Fair Isaac Corporation Confidential and Proprietary Information

p. 143140

Utility routines

XADid
PurposeObtain a unique identifier to represent objects.
Synopsisfunction XADid:integer
Return value
Automatically incremented unique identifier.
Exampledeclarations
id_win=XADid
id_canvas=XADid
id_button=XADid...
end-declarations

Fair Isaac Corporation Confidential and Proprietary Information

141

Utility routines

XADsavescreenshot
PurposeTake a screenshot of an object and save it to a file.
Synopsisprocedure XADsavescreenshot(id:integer, filename:string)Arguments
id
Object identifier (may be a window or any other object type)
filename Name of image file (must have one of these extensions: .jpg, .gif, .bmp, .png)
ExampleXADsavescreenshot(id_canvas,"canvas.png")
XADsavescreenshot(id_win,"MyXADApplication.jpg")

Fair Isaac Corporation Confidential and Proprietary Information

142

Utility routines

XADseteventcallback
PurposeSet the event handler callback
Synopsisprocedure XADseteventcallback(handlername:string)Argument
handlername

Event handler callback

Further information
This procedure registers the procedure handlername to act as an event handler callback. All
events will be reported through this callback. The callback procedure has this signature:procedure guievents(id:integer, event:integer)
and it gets called for every possible event. The user has the option to ignore or deal with events
through the event handler callback procedure.

Fair Isaac Corporation Confidential and Proprietary Information

143

Utility routines

XADhandleevents
PurposeHandling events during program execution.
Synopsisprocedure XADhandleevents
Further information
If a long calculation (e.g. optimization) is initiated by the event handler callback, the userinterface will freeze. This is due to the fact that the processor intensive operations take place on
the same thread as the code that draws the user interface or responds to user events (after all, we
are dealing with an event). To avoid this phenomenon, call XADhandleevents at regularintervals (e.g. during Optimizer callbacks) to allow the user to interact with the user interface.
Use caution, however as the following call sequence is likely to occur:
guievents(1,1)
callsminimize(objective)
calls
globallog
calls
XADhandleevents
calls
guievents(1,10)
calls
???
While an optimization is running events should be dealt with quickly and with little (if wellunderstood) or no side effects. In this situation one could use XADseteventcallback to switch
to an alternative, simplified event handler callback.
Related topics
XADseteventcallback

Fair Isaac Corporation Confidential and Proprietary Information

144

Utility routines

XADchoosefile
Purpose
Display file selection dialog.
Synopsisfunction XADchoosefile(openorsave:boolean):string
function XADchoosefile(openorsave:boolean, filetypes:string):string
function XADchoosefile(openorsave:boolean, filetypes:string,
dir:string):stringArguments
openorsave Dialog type selection.
true
create an Open file dialog
false
create a Save file dialog
filetypes
File filters based on file extensions. See example below
dir
The initial folder displayed in the file dialog.
Return value
File name if selection was successful, otherwise an empty string.
Examplefilename:=XADchoosefile(true,"My own type of files (*.myotf)|*.myotf"+"|"+"MPS files(*.mps)|*.mps"+"|"+"All Files (*.*)|*.*"+"|")
Further information
This is a convenience routine for displaying the standard Windows file selection dialog. Pass trueas an argument to create an Open file dialog and false to create a Save file dialog. If the fileselection was successful, the returned string contains the file name. If not, the function returns anempty string. The second form of the function allows use of filters based on the file extension.

Fair Isaac Corporation Confidential and Proprietary Information

145

Utility routines

XADpopupmenu
PurposeCreation of a pop-up menu.
Synopsisfunction XADpopupmenu(menuitems:set of string):stringArgument
menuitems

Menu items

Return value
Selected item, or empty string if no selection was made.
ExampleTo create a menu with the items Action A and Action B separated by a line, use the following:
choice:=XADpopupmenu({"ActionA", "XADseparator", "Action B"})
Further information
It is customary for user interfaces to display a menu of options when the user right-clicks onsomething. This routine achieves just that. When the user makes a choice, it is returned as astring. If the user does not select anything, the returned string will be empty.

Fair Isaac Corporation Confidential and Proprietary Information

146

Utility routines

XADgetsystemmetrics
PurposeGets the given Windows system metrics value
Synopsisfunction XAdgetsystemmetrics(sm:integer):integer
Argumentsm

One of the SM_* constants used by the Windows API GetSystemMetricsFunction. Thesecan be found in the Windows SDK file WinUser.h

Return value
The value of the system metrics; in accordance with the spec of the Windows API functions, a
return value of zero may either indicate failure or be a valid return value for the given parameter.
ExampleSM_MOUSEPRESENT := 19 ! from Windows API docs
hasMouse := XADgetsystemmetrics(SM_MOUSEPRESENT) <> 0
Further information
There are convenience functions in XAD to get information about the desktop resolution, using
this function.
Related topics
XADgetdesktopwidth, XADgetdesktopheight, XADgetvirtualscreenwidth,
XADgetvirtualscreenheight, XADgetvirtualscreenx, XADgetvirtualscreenhy

Fair Isaac Corporation Confidential and Proprietary Information

147

Utility routines

XADgetdesktopwidth
PurposeGets the width of the primary monitor’s desktop
Synopsisfunction XADgetdesktopwidth:integer
Return value
The width of the primary monitor’s desktop, in pixels
ExampledesktopWidth := XADgetdesktopwidth
Further information
Equivalent to calling XADgetsystemmetrics with a parameter of the Windows API constant
SM_CXSCREEN
Related topics
XADgetsystemmetrics, XADgetdesktopheight

Fair Isaac Corporation Confidential and Proprietary Information

148

Utility routines

XADgetdesktopheight
PurposeGets the height of the primary monitor’s desktop
Synopsisfunction XADgetdesktopheight:integer
Return value
The height of the primary monitor’s desktop, in pixels
ExampledesktopHeight := XADgetdesktopheight
Further information
Equivalent to calling XADgetsystemmetrics with a parameter of the Windows API constant
SM_CYSCREEN
Related topics
XADgetsystemmetrics, XADgetdesktopwidth

Fair Isaac Corporation Confidential and Proprietary Information

149

Utility routines

XADgetvirtualscreenwidth
PurposeGets the width of the virtual screen
Synopsisfunction XADgetvirtualscreenwidth:integer
Return value
The width of the virtual screen, in pixels
ExamplescreenWidth := XADgetvirtualscreenwidth
Further information
Equivalent to calling XADgetsystemmetrics with a parameter of the Windows API constant
SM_CXVIRTUALSCREEN
Related topics
XADgetsystemmetrics, XADgetvirtualscreenheight, XADgetvirtualscreenx,
XADgetvirtualscreenhy

Fair Isaac Corporation Confidential and Proprietary Information

150

Utility routines

XADgetvirtualscreenheight
PurposeGets the height of the primary monitor’s virtual screen
Synopsisfunction XADgetvirtualscreenheight:integer
Return value
The height of the virtual screen, in pixels
ExamplescreenHeight := XADgetvirtualscreenheight
Further information
Equivalent to calling XADgetsystemmetrics with a parameter of the Windows API constant
SM_CYVIRTUALSCREEN
Related topics
XADgetsystemmetrics, XADgetvirtualscreenwidth, XADgetvirtualscreenx,
XADgetvirtualscreenhy

Fair Isaac Corporation Confidential and Proprietary Information

151

Utility routines

XADgetvirtualscreenx
PurposeGets the x-coordinate of the virtual screen
Synopsisfunction XADgetvirtualscreenx:integer
Return value
The x-coordinate of the virtual screen, in pixels
Examplexcoord := XADgetvirtualscreenx
Further information
Equivalent to calling XADgetsystemmetrics with a parameter of the Windows API constant
SM_XVIRTUALSCREEN
Related topics
XADgetsystemmetrics, XADgetvirtualscreenwidth, XADgetvirtualscreenheight,
XADgetvirtualscreenhy

Fair Isaac Corporation Confidential and Proprietary Information

152

Utility routines

XADgetvirtualscreeny
PurposeGets the y-coordinate of the virtual screen
Synopsisfunction XADgetvirtualscreeny:integer
Return value
The y-coordinate of the virtual screen, in pixels
Exampleycoord := XADgetvirtualscreeny
Further information
Equivalent to calling XADgetsystemmetrics with a parameter of the Windows API constant
SM_YVIRTUALSCREEN
Related topics
XADgetsystemmetrics, XADgetvirtualscreenwidth, XADgetvirtualscreenheight,
XADgetvirtualscreenx

Fair Isaac Corporation Confidential and Proprietary Information

153

C HAPTER 10

XAD examples
10.1

Simple example
A simple assignment problem will be used to illustrate how XAD works with Mosel to create
interactive mathematical programming models.
Here is a screenshot of the application:

Figure 10.1: Interactive mathematical programming model

The user can modify the preferences by changing the numbers in the input boxes in the upper
left corner. After pressing Solve, the results are shown in the diagram. This procedure can be
repeated any number of times.
Let’s examine the code, piece by piece:

Here, we tell Mosel that we need to use Xpress-Optimizer (mmxprs) as well as XAD (mmxad) tobuild this application. We also declare some identifiers to be used later in the model, such as thedecision variable array assign.

Fair Isaac Corporation Confidential and Proprietary Information

154

XAD examples

In the next section:

We assign some suggested preferences (these will be editable by the user). The objective function
Satisfaction reflects the overall sum of preferences depending on whether assignments are madeor not. Two sets of constraints, one person per project and one project per person complete themathematical formulation of this model.
Let’s examine the user interface code:

In the code above, a new group of declarations is used to assign unique ids to various GUI objects.
The window is created first, then the XAD objects are created one by one, with id_win as theirparent. Note that id_inputs and id_texts are special in the sense that they are used in
combination with i and j to create unique ids for more than one item. Also note how theexpresion ""+PREF(i,j) actually fills each input object with the corresponding preference
rating.
The coordinates and dimensions of all the GUI objects can be derived using the Xpress
Application Developer Designer tool, which is a Mosel program (written with XAD) that acts as a
What You See Is What You Get GUI editor. Some experimentation with layout may be needed
before the end result is satisfactory.
The use of integers as ids for XAD objects facilitates grouping objects in easy to understand andmanage categories (such as all the inputs above). The user should take advantage of this feature,especially for large models/applications.
The canvas id_canvas displays the results of our optimization problem. An entire procedure isdedicated to updating this object with the most recent information:

Fair Isaac Corporation Confidential and Proprietary Information

155

XAD examples

As a general rule, a canvas should be erased first using XADcanvaserase. After all the drawing iscomplete, call XADcanvasrefresh to update the contents of the canvas.
The procedure UpdateCanvas draws a grid and then updates each cell based on the optimized
values in the assign array. If the assignment is made, a check mark is also drawn in the cell froma bitmap image file. If an assignment is not made, the text in the cell is drawn with a lighter
shade of gray to de-emphasize it.
We shall now examine the event handling callback procedure and the code that kick starts theapplication.

Three events are of interest to us in this application: When the window opens and when either of
the two buttons is pressed.
When the id_buttonsolve button is pressed Mosel must update the array of preferences(taken directly from the input objects), update the objective function based on the new
preferences, optimize the problem, and finally update the canvas so that it shows the new
set of assignments.

When the id_buttonexit button is pressed, the window is closed immediately.

The event XAD_EVENT_WINDOW_OPENED should be handled to update the status of awindow before the user has a chance to interact with it. It is the first event in the lifetime ofa window.

Two more statements in the Mosel code are of interest. We must ensure that
XADseteventcallback is called before opening the window, so that the window can send its

Fair Isaac Corporation Confidential and Proprietary Information

156

XAD examples

events to it. Finally, XADwindowopen opens the window, giving it control over the execution(through events).
Note that when we call XADwindowclose or when we close the window with the mouse,
execution of the Mosel code in fact continues with the statement following XADwindowopen (inthis case there’s nothing else to execute, so the application ends). This means that we should
always think of windows as mere components of a Mosel application that temporarily gain
control of the Mosel execution through the event handler. Mosel is always in charge and candismiss a window at any time.

10.2

Resource Example
The following tutorial is taken from the IVE help documentation. If you have not used IVE
previously and wish to see a more in-depth explanation of the various dialog controls it isrecommended that you view the IVE compiled help.
In order to demonstrate the use of the XAD Resource Editor and the associated XAD Mosel
commands we will now look at the example "500selectiongroups.mos", in the XAD examples
folder of the Xpress installation. This example not only covers the use of resources, but the
manipulation of resource generated groups within Mosel code and the use of an object inmultiple groups.

+=>

To begin with load the "500selectiongroups.mos" file in to IVE and view the behaviour of themodel when run.
In the example the tab object works by picking up the tab’s SELECTION event, calling the relevant
Mosel callback (Tabs_Window_SELECTION) and then setting the enabled and visible flags of theobjects relevant to the currently selected tab. In this case the code required to do this isreasonably simple as we have setup groups of objects which we may hide or show with one
command. Herein lies the power of object groups.
We will now look at the various sections of the example’s Mosel code, before looking at theassociated resource in the XAD Resource Editor.

Fair Isaac Corporation Confidential and Proprietary Information

157

XAD examples

10.2.1The Mosel Code

The Mosel code has the following parts (ignoring those parts common to standard Mosel models):

1. Load the window from resource: Here we load the resource file in to the model. All
resources equate to one XAD window and the return value of the function used to load theresource, XADloadresource, is the id of the XAD window object (id_win, in this case).
2. Retrieve the object/group ids: Although we need not retrieve the object ids for all of theresource objects, if we wish to manipulate or respond to events for that object we must do
so. When creating the resource each object/group will have been given a name (either thedefault "XAD_OBJECTTYPE_COUNTER", or set by the user) and it is this that we will use to
retrieve the object ids.
Using the XAD functions XADgetid and XADgroupgetid we may retrieve the ids for objects
and groups, respectively.
3. Display the window: This function opens the specified XAD window and displays all the
associated objects. In order to only display/enable those objects relevant for the initiallydisplayed tab we will need to setup the object states when the window opens. This isachieved via a WINDOW_OPENED event callback.
4. procedure Window_WINDOW_OPENED: In this callback we need to setup the various statesof the objects/groups belonging to each tab selection. There are six groups within theexample, 3 relating directly to those objects displayed on each tab, and 3 relating to thebuttons on the right hand side of the example.

Fair Isaac Corporation Confidential and Proprietary Information

158

XAD examples

The right hand side buttons demonstrate that when the Button, Canvas or Text tabs are
selected the relevant buttons are enabled or disabled. These differ from the groups setup
for the objects in the tab control as each button may belong to more than one group(Group B, C or T depending on which tab selections they will be enabled for).
We intially have the "Button" tab selected and so within this callback we enable the
id_group_button and id_group_B groups and disable the others.
Note: there are no events associated with the buttons in this example and so they will not
actually perform any action if clicked.
5. procedure Tabs_Window_SELECTION: This callback is in essence very similar to the
WINDOW_OPENED callback, above. The difference being that we must check for thecurrently selected tab and then disable/enable and show/hide the relevant groups for eachtab.
As the comment in the code mentions, it is important to get the order of the commands
correct if you are dealing with objects in multiple groups. Were the command orderincorrect you may inadvertently enable and then disable an object (belonging to multiple
groups) that you intended to be enabled.
Note: It is recommended to first disable all the groups you need to before finally enabling
the relevant group or groups (as in this example).
6. procedure Exit_Window_PRESSED: When the "Exit" button is PRESSED this callback is called.
All it does is cleanly close the id_win window so that the program closes in a user controlled
and clean manner.

10.2.2The Associated Resource File
The resource file associated with the example, "Resource_500.rsc", can be found in the XAD
examples directory alongside the Mosel file. Once loaded in to IVE you will be presented with the
XAD Resource Editor and the representation of the XAD window and objects will be visible in theForm Edit Dialog (FED).

When initially loaded all of the objects within the tab will be visible. To hide a group of objects
within the editor select the group from the XAD Properties Dialog Group drop-down list andthen select the option to Hide Group in Editor.

Fair Isaac Corporation Confidential and Proprietary Information

159

XAD examples

This behaviour can be used to quickly shift between group selections designed for use in tab
objects. In this example we will hide the Buttons group and show the Canvas group:
1. Select the group you wish to hide:

Here we’ve selected the Buttons group. It’s currently visible in the editor.
2. Hide the Buttons group:

By selecting the Hide Group in Editor option we hide the Buttons group.
3. Unhide the Canvas group:

Fair Isaac Corporation Confidential and Proprietary Information

160

XAD examples

By selecting the Canvas group in the drop-down list, and unselecting the Hide Group in
Editor option, the Canvas group becomes visible in the editor.
The events for the objects on the resource may be added, or navigated to, via the XAD Event
Dialog. This is shown when an object, or the form itself, is double left-clicked.

As an example we will now navigate to the "Exit" button callback discussed earlier. To do so,
firstly double click the "Exit" button in the FED to open the Event Dialog for the button. Once
this is open we can navigate to the event callback in the following manner:
1. Select the Event: In this case we wish to select the PRESSED event, but were you adding a
different event you could select any of the events offered to you in the drop-down list.
2. Select the Mosel File: We wish to navigate to the event callback already set in"500selectiongroups.mos", but you could choose to add the event to any valid Mosel file inwhich you intend to load the "Resource_500.rsc".
3. Go to Procedure: Once you’ve selected the event and file you wish click the button and you
will be taken to the relevant callback in the file specified. In this case the callback alreadyexists and so you should now see the XADwindowclose function call which forms theoperational code of the callback.

Fair Isaac Corporation Confidential and Proprietary Information

161

XAD examples

If you’d chosen to add a currently non-existent event callback to the file then the code partof the callback would contain the default "Not yet implemented" Mosel text output.

10.3

Notes
When developing XAD applications in Xpress-IVE, do not use the Stop feature to end theprogram execution. This could interrupt the Mosel execution during a system call dealing withthe user objects, leaving Mosel and IVE in a corrupt state. Always close all XAD windows insteadof using Stop.
For more instances of XAD applications please refer to the set of examples that accompanies XAD.

Fair Isaac Corporation Confidential and Proprietary Information

162

A PPENDIX A

Contacting FICO
FICO provides clients with support and services for all our products. Refer to the following
sections for more information.

Product support
FICO offers technical support and services ranging from self-help tools to direct assistance with a
FICO technical support engineer. Support is available to all clients who have purchased a FICO
product and have an active support or maintenance contract. You can find support contact
information on the Product Support home page (www.fico.com/support).
On the Product Support home page, you can also register for credentials to log on to FICO Online
Support, our web-based support tool to access Product Support 24x7 from anywhere in the world.
Using FICO Online Support, you can enter cases online, track them through resolution, findarticles in the FICO Knowledge Base, and query known issues.
Please include ’Xpress’ in the subject line of your support queries.

Product education
FICO Product Education is the principal provider of product training for our clients and partners.
Product Education offers instructor-led classroom courses, web-based training, seminars, andtraining tools for both new user enablement and ongoing performance support. For additional
information, visit the Product Education homepage at www.fico.com/en/product-training or
email producteducation@fico.com.

Product documentation
FICO continually looks for new ways to improve and enhance the value of the products andservices we provide. If you have comments or suggestions regarding how we can improve thisdocumentation, let us know by sending your suggestions to techpubs@fico.com.

Fair Isaac Corporation Confidential and Proprietary Information

163

Contacting FICO

Sales and maintenanceUSA, CANADA AND ALL AMERICASEmail: XpressSalesUS@fico.com
WORLDWIDE
Email: XpressSalesUK@fico.com
Tel: +44 207 940 8718
Fax: +44 870 420 3601
Xpress Optimization, FICO
FICO HouseInternational Square
Starley Way
Birmingham B37 7GN
UK

Related services
Strategy Consulting: Included in your contract with FICO may be a specified amount ofconsulting time to assist you in using FICO Optimization Modeler to meet your business needs.
Additional consulting time can be arranged by contract.
Conferences and Seminars: FICO offers conferences and seminars on our products and services.
For announcements concerning these events, go to www.fico.com or contact your FICO accountrepresentative.

About FICO
FICO (NYSE:FICO) delivers superior predictive analytics solutions that drive smarter decisions. The
company’s groundbreaking use of mathematics to predict consumer behavior has transformed
entire industries and revolutionized the way risk is managed and products are marketed. FICO’sinnovative solutions include the FICO® Score—the standard measure of consumer credit risk in
the United States—along with industry-leading solutions for managing credit accounts,
identifying and minimizing the impact of fraud, and customizing consumer offers with pinpoint
accuracy. Most of the world’s top banks, as well as leading insurers, retailers, pharmaceuticalcompanies, and government agencies, rely on FICO solutions to accelerate growth, control risk,
boost profits, and meet regulatory and competitive demands. FICO also helps millions ofindividuals manage their personal credit health through www.myfico.com. Learn more atwww.fico.com. FICO: Make every decision countTM .

Fair Isaac Corporation Confidential and Proprietary Information

164

IndexA
append item, 51, 56
append text, 30, 38
arc, 85
assignment problem, 154Bbrowser, 9, 92
create, 91
button, 10
create, 33
button pressed event, 104C
callback
event handler, 143
canvas, 10
create, 73
draw arc, 85
draw box, 74
draw chord, 86
draw ellipse, 75
draw image, 78
draw line, 80
draw pie, 84
draw point, 81
draw polygon, 83
draw rectangle, 82
draw text, 87
erase, 76map, 88save from file, 79
unmap, 89
update, 77
check button, 11
create, 43
retrieve state, 45
set state, 44
chord, 86close window, 23
color, 90color constants, 11create browser, 91
create button, 33
create canvas, 73
create check button, 43
create droplist, 55
create editor, 37
create group, 49
create input, 34
create list, 50
create multilist, 65

Fair Isaac Corporation Confidential and Proprietary Information

create progress bar, 60
create radio button, 46
create scrollbar, 95
create tab, 62
create text, 29
create tree, 98
create window, 21D
delete, 6, 120, 130
draw arc, 85
draw box, 74
draw chord, 86
draw ellipse, 75
draw image, 78
draw line, 80
draw pie, 84
draw point, 81
draw polygon, 83
draw rectangle, 82
draw text, 87
drop list, 11
droplist
append item, 56
create, 55
retrieve item, 57
select item, 58
show, 59
E
editor, 12
create, 37
retrieve text, 42
editor changed event, 104
ellipse, 75
erase canvas, 76
event, 2, 3, 7
button pressed, 104
editor changed, 104
input changed, 104
key pressed, 137
key released, 138
left mouse button double click, 138
left mouse button pressed, 138
left mouse button released, 138menu, 102
mouse moved, 138
right mouse button double click, 139
right mouse button pressed, 139
right mouse button released, 139
scrollbar changed, 104
selection, 104165

Indextimer, 102
window closed, 103
window closing, 103
window hidden, 103
window moved, 103
window opened, 103
window resized, 103
window shown, 104
event callback, 2, 3
event handler callback, 143
event handling, 144
event text, 136

left mouse button pressed event, 138
left mouse button released event, 138line, 80
list, 13
append item, 51
create, 50
multiple, 14
retrieve item, 52
select item, 53
show, 54
load file, 39
load resource, 129

F
file

M
making visible, 135
map canvas, 88
menu, 28
menu event, 102
mmxad.dso, 4Mosel language, 2
MOSEL_DOS, 4mouse
x coordinate, 122y coordinate, 123
mouse moved event, 138
multilist
create, 65
dynamic, 67
set column name, 68
set list item, 69
show, 66
static, 67
multiple lists, 14load, 39
save to, 40
file selection dialog, 145
focus, 131G
get selected tab, 63
getid, 128
group
create, 49
group add member, 108
group create, 107
group disband, 109
group enable, 118
group get height, 112
group get width, 113
group get xpos, 114
group get ypos, 115
group getid, 111
group remove member, 110
group set visible, 117
group setpos, 116
groupbasics, 105GUI, 2Hheight, 127
hide window, 25
hiding, 135
I
identifier, 141
input, 13create, 34
retrieve text, 36
input changed event, 104interactive mathematical programming model,
154
K
keep window, 26
key pressed event, 137
key released event, 138
Lleft mouse button double click event, 138

Fair Isaac Corporation Confidential and Proprietary InformationO
objectdelete, 6, 120, 130
focus, 131
getid, 128
height, 127
hidden, 135
loadresource, 129
reposition, 133setname, 132
textual information, 134
user interaction, 121
visible, 135
width, 126
x coordinate, 124y coordinate, 125
object group, 12
object identifier, 2
open window, 22P
pie, 84
point, 81
polygon, 83
pop-up menu, 146
progress bar, 14

166

Indexcreate, 60
set state, 61Rradio button, 15
create, 46
retrieve state, 48
set state, 47
rectangle, 74, 82
replace text, 31, 35, 41
reposition, 133
reset timer, 27
retrieve item, 52, 57
retrieve state, 45, 48
retrieve text, 32, 36, 42
right mouse button double click event, 139
right mouse button pressed event, 139
right mouse button released event, 139
Ssave from file, 79
save to file, 40
screenshot, 142
any object, 142
scrollbar
create, 95
initialize, 97
position, 96
scrollbar changed event, 104
scrollbar position, 96
scrollbar settings, 97
scrolling, 15
select a tab, 64
select item, 53, 58
selection event, 104
set column name, 68
set list item, 69
set progress, 61
set state, 44, 47
setname, 132
show droplist, 59
show list, 54, 66
show window, 24Ttab, 16
create, 62
text, 16
append, 30, 38
create, 29
replace, 31, 35, 41
retrieve, 32
textual information, 134
timer event, 102
tree, 17, 99
add branch, 99
clear, 100
create, 98
expand, 101
reset, 100

Fair Isaac Corporation Confidential and Proprietary InformationU
unique identifier, 141
unmap canvas, 89
update canvas, 77
user interaction, 121Wwidth, 126
window, 17
close, 23
create, 21
hide, 25
keep, 26
menu, 28
open, 22
reset timer, 27
show, 24window close event, 103
window closing event, 103
window hidden event, 103
window moved event, 103
window opened event, 103
window resized event, 103
window shown event, 104X
x coordinate, 122, 124
XAD, 2
XAD_BROWSER_MESSAGE, 102
XAD_EVENT_CHANGED, 104
XAD_EVENT_KEYDOWN, 137
XAD_EVENT_KEYUP, 138
XAD_EVENT_MENU, 102
XAD_EVENT_MOUSE_LEFTDBCLK, 138
XAD_EVENT_MOUSE_LEFTDOWN, 138
XAD_EVENT_MOUSE_LEFTUP, 138
XAD_EVENT_MOUSE_MOVED, 138
XAD_EVENT_MOUSE_RIGHTDBCLK, 139
XAD_EVENT_MOUSE_RIGHTDOWN, 139
XAD_EVENT_MOUSE_RIGHTUP, 139
XAD_EVENT_PRESSED, 104
XAD_EVENT_SELECTION, 104
XAD_EVENT_TIMER, 102
XAD_EVENT_WINDOW_CLOSED, 103
XAD_EVENT_WINDOW_CLOSING, 103
XAD_EVENT_WINDOW_HIDDEN, 103
XAD_EVENT_WINDOW_MOVED, 103
XAD_EVENT_WINDOW_OPENED, 103
XAD_EVENT_WINDOW_RESIZED, 103
XAD_EVENT_WINDOW_SHOWN, 104
XAD_BLACK, 11
XAD_BLUE, 11
XAD_BOTTOM, 87
XADbrowsergetmessage, 93
XADbrowsergetvalue, 94
XADbrowsergoto, 92
XADcanvasdrawarc, 85
XADcanvasdrawbox, 74
XADcanvasdrawchord, 86
XADcanvasdrawellipse, 75167

IndexXADcanvasdrawimage, 78
XADcanvasdrawline, 80
XADcanvasdrawpie, 84
XADcanvasdrawpoint, 81
XADcanvasdrawpolygon, 83
XADcanvasdrawrectangle, 82
XADcanvasdrawtext, 87
XADcanvaserase, 76
XADcanvasmap, 88
XADcanvasrefresh, 77
XADcanvassaveimage, 79
XADcanvasunmap, 89
XAD_CENTERH, 87
XAD_CENTERV, 87
XADcheckgetstate, 45
XADchecksetstate, 44
XADchoosefile, 145
XADcolor, 90
XADcreatebrowser, 91
XADcreatebutton, 33
XADcreatecanvas, 73
XADcreatecheck, 43
XADcreatedroplist, 55
XADcreateeditor, 37
XADcreategroup, 49
XADcreateinput, 34
XADcreatelist, 50
XADcreatemultilist, 65
XADcreateprogress, 60
XADcreateradio, 46
XADcreatescrollbar, 95
XADcreatetab, 62
XADcreatetext, 29
XADcreatetree, 98
XADcreatewindow, 21
XAD_CYAN, 11
XAD_DEFAULT, 87
XADdestroy, 120
XADdroplistadd, 56
XADdroplistgetsel, 57
XADdroplistselect, 58
XADdroplistshow, 59
XADeditoraddtext, 38
XADeditorgettext, 42
XADeditorload, 39
XADeditorsave, 40
XADeditorsettext, 41
XADenable, 121
XADgetdesktopheight, 149
XADgetdesktopwidth, 148
XADgeteventtext, 136
XADgeth, 127
XADgetid, 128
XADgetmousex, 122
XADgetmousey, 123
XADgetsystemmetrics, 147
XADgetvirtualscreenheight, 151
XADgetvirtualscreenwidth, 150
XADgetvirtualscreenx, 152
XADgetvirtualscreeny, 153

Fair Isaac Corporation Confidential and Proprietary Information

XADgetw, 126
XADgetx, 124
XADgety, 125
XAD_GREEN, 11
XADgroupaddmember, 108
XADgroupcreate, 107
XADgroupdisband, 109
XADgroupenable, 118
XADgroupgeth, 112
XADgroupgetid, 111
XADgroupgetw, 113
XADgroupgetx, 114
XADgroupgety, 115
XADgroupremovemember, 110
XADgroupsetpos, 116
XADgroupsetvisble, 117
XADhandleevents, 144
XADid, 141
XADinputgettext, 36
XADinputsettext, 35
XAD_LEFT, 87
XADlistadd, 51
XADlistgetsel, 52
XADlistselect, 53
XADlistshow, 54
XADloadresource, 129
XAD_MAGENTA, 11
XADmultilistgetsel, 70
XADmultilistrefresh, 72
XADmultilistsetcolname, 68
XADmultilistsetcolors, 71
XADmultilistsetsize, 67
XADmultilistsettext, 69
XADmultilistshow, 66
XAD_ORANGE, 11
XADpopupmenu, 146
XADprogressset, 61
XADradiogetstate, 48
XADradiosetstate, 47
XAD_RED, 11
XADrefresh, 130
XAD_RIGHT, 87
XADsavescreenshot, 142
XADscrollbargetpos, 96
XADscrollbarset, 97
XADseteventcallback, 143
XADsetfocus, 131
XADsetname, 132
XADsetpos, 133
XADsettext, 134
XADsetvisible, 135
XADtabgettab, 63
XADtabsettab, 64
XADtextaddtext, 30
XADtextgettext, 32
XADtextsettext, 31
XAD_TOP, 87
XADtreeadd, 99
XADtreeexpand, 101
XADtreereset, 100

168IndexXAD_WHITE, 11
XADwindowaddmenu, 28
XADwindowclose, 6, 23
XADwindowhide, 6, 25
XADwindowkeep, 26
XADwindowopen, 6, 22
XADwindowsettimer, 27
XADwindowshow, 6, 24
XAD_YELLOW, 11Yy coordinate, 123, 125

Fair Isaac Corporation Confidential and Proprietary Information

169