Элементарные экспертные системы. Разработка экспертной системы для тестирования знаний по теме «Списки и рекурсия»., страница 3

mesbox_defaultFirst, mesbox_suspendApplication),

explainResults(R,S,B),

retractall(cur_question(_)), retractall(result(_,_)),

menu_Enable(_Win, idr_user, b_True),

Lbox = win_GetCtlHandle(_Win, listbox1),

lbox_Clear(Lbox),

win_Invalidate(_Win),!;

retractall(cur_question(_)), retractall(result(_,_)),

menu_Enable(_Win, idr_user, b_True),

Lbox = win_GetCtlHandle(_Win, listbox1),

lbox_Clear(Lbox),

win_Invalidate(_Win),

!.

PREDICATES

task_win_eh : EHANDLER

CONSTANTS

%BEGIN Task Window, CreateParms, 10:41:18-29.5.2007, Code automatically updated!

task_win_Flags = [wsf_SizeBorder,wsf_TitleBar,wsf_Close,wsf_Maximize,wsf_Minimize,wsf_ClipSiblings]

task_win_Menu  = res_menu(id_menu1)

task_win_Title = "Лабораторная работа №5"

task_win_Help  = contents

%END Task Window, CreateParms

CLAUSES

%BEGIN Task Window, e_Create

task_win_eh(_Win,e_Create(_),0):-!,

%BEGIN Task Window, InitControls, 10:41:18-29.5.2007, Code automatically updated!

win_CreateControl(wc_LBox,rct(8,62,526,125),"",_Win,[wsf_Group,wsf_TabStop,wsf_NoIntegralHeight],listbox1),

win_CreateControl(wc_PushButton,rct(144,132,391,155),"OK",_Win,[wsf_Group,wsf_TabStop,wsf_Default],idc_ok),

%END Task Window, InitControls

readConfig,

Xmax = vpi_GetAttrVal(attr_screen_width),

Ymax = vpi_GetAttrVal(attr_screen_height), Hb = vpi_GetAttrVal(attr_frame_width),

Vb = vpi_GetAttrVal(attr_frame_height), Mh = vpi_GetAttrVal(attr_menu_height),

XL = 550+Hb, YL = 180+Vb+Mh, X1 = (Xmax-XL)/2, Y1 = (Ymax-Yl)/2,

X2 = X1+XL, Y2 = Y1+YL,

win_Move(_Win, rct(X1, Y1, X2, Y2)),

!.

%END Task Window, e_Create

%MARK Task Window, new events

%BEGIN Task Window, idr_user

task_win_eh(_Win,e_Menu(idr_user,_ShiftCtlAlt),0):-!,

Color = win_GetAttrVal(_Win, attr_color_window),

Pen = pen(1, ps_Solid, Color),

Brush = brush(pat_Solid, Color),

win_SetPen(_Win, Pen),

win_SetBrush(_Win, Brush),

retractall(cur_question(_)), assert(cur_question(1)),

retractall(excluded(_)), assert(excluded([])),

retractall(result(_,_)),

do_inquiry(_Win),

!.

%END Task Window, idr_user

%BEGIN Task Window, idr_info

task_win_eh(_Win,e_Menu(idr_info,_ShiftCtlAlt),0):dlg_help_Create(_Win),

!.

%END Task Window, idr_info

%BEGIN Task Window, listbox1 activated

task_win_eh(_Win,e_Control(listbox1,_CtrlType,_CtrlWin,activated),0):-!,

Ok = win_GetCtlHandle(_Win, idc_ok),

win_SendEvent(_Win,e_Control(idc_ok,wc_PushButton,Ok,activated())),

!.

%END Task Window, listbox1 activated

%BEGIN Task Window, e_Update

task_win_eh(_Win,e_Update(_UpdateRct),0):cur_question(K),

question(K,Q), str_len(Q,L), treatCR(Q,Q1,L),

format(QQ, "Вопрос №%d.\n%s", K, Q1),

Rect = rct(7, 20, 461, 140),

draw_Rect(_Win, Rect),

draw_TextInRect(_Win, Rect, QQ, -1, [dtext_Left,dtext_Top,dtext_Wordbreak]),

!.

%END Task Window, e_Update

%BEGIN Task Window, idc_ok _CtlInfo

task_win_eh(_Win,e_Control(idc_ok,_CtrlType,_CtrlWin,_CtlInfo),0):Lbox = win_GetCtlHandle(_Win, listbox1),

lbox_GetSel(Lbox,_,L), L = [H], K = H+1,

cur_question(Q),

assert(result(Q,K)),

q_num(N),

getScores(Q,K,S),

addExcluded(Q,S),

getNextQuestion(Q,Cur,N),

retractall(cur_question(_)), assert(cur_question(Cur)),

do_inquiry(_Win),!;

Lbox = win_GetCtlHandle(_Win, listbox1),

lbox_GetSel(Lbox,_,L), L = [_],

printResults(_Win),!;

dlg_Error("Внимание!", "Выберите один из вариантов!"),

!.

%END Task Window, idc_ok _CtlInfo

%BEGIN Task Window, e_Size

task_win_eh(_Win,e_Size(_Height,_Width),0):-!,

Xmax = vpi_GetAttrVal(attr_screen_width),

Ymax = vpi_GetAttrVal(attr_screen_height), Hb = vpi_GetAttrVal(attr_frame_width),

Vb = vpi_GetAttrVal(attr_frame_height), Mh = vpi_GetAttrVal(attr_menu_height),