! ! LOAN_DISPLAY.UIL User Interface for the LOAN program ! ! The initial height and width of the ADB are set in the LOAN.DAT resource file. ! ! module loan_display version = 'V1.0' names = case_insensitive objects = { Label = gadget; Push_Button = gadget; } include file 'DwtAppl.uil'; value k_interval_weekly: 0; k_interval_fortnightly: 1; k_interval_monthly: 2; k_interval_bimonthly: 3; k_interval_quarterly: 4; k_interval_6monthly: 5; k_interval_yearly: 6; k_field_principal: 0; k_field_rate: 1; k_field_payment: 2; title_y_offset: 0; input_y_offset: 10; hist_y_offset: 20; list_box_font: font ('-Adobe-Courier-Bold-R-Normal--*-120-*-*-M-*-ISO8859-1'); procedure create_data_field (integer); create_list_box (); set_interval (integer); text_value_changed (integer); calculate_button_pressed (); quit (); object main: Attached_Dialog_Box { controls { Label title; Label loan_label; Simple_Text loan_field; Label rate_label; Simple_text rate_field; Label rate_label_2; Option_Menu repayment_interval; Label qty_label; Simple_Text qty_field; Label rep_hist_title; List_Box repayment_history; Push_Button Calculate_button; Push_Button Quit_Button; }; }; title: Label { arguments { adb_left_attachment = DwtAttachAdb; adb_right_attachment = DwtAttachAdb; label_label = compound_string ('Home Mortgage Repayments Predictor'); }; }; loan_field: Simple_Text { arguments { adb_top_attachment = DwtAttachWidget; adb_top_widget = Label title; adb_top_offset = 16; adb_left_attachment = DwtAttachPosition; adb_left_position = 50; rows = 1; cols = 10; max_length = 10; resize_height = False; resize_width = False; }; callbacks { create = procedure create_data_field (k_field_principal); ! value_changed = procedure text_value_changed (k_field_principal); }; }; rate_field: Simple_Text { arguments { adb_top_attachment = DwtAttachWidget; adb_top_widget = Simple_Text loan_field; adb_top_offset = input_y_offset; adb_left_attachment = DwtAttachOppWidget; adb_left_widget = Simple_Text loan_field; adb_left_offset = 0; rows = 1; cols = 5; max_length = 5; resize_height = False; resize_width = False; }; callbacks { create = procedure create_data_field (k_field_rate); ! value_changed = procedure text_value_changed (k_field_rate); }; }; qty_field: Simple_Text { arguments { adb_top_attachment = DwtAttachWidget; adb_top_widget = Simple_Text rate_field; adb_top_offset = input_y_offset; adb_left_attachment = DwtAttachOppWidget; adb_left_widget = Simple_Text loan_field; adb_left_offset = 0; rows = 1; cols = 10; max_length = 10; resize_height = False; resize_width = False; }; callbacks { create = procedure create_data_field (k_field_payment); ! value_changed = procedure text_value_changed (k_field_payment); }; }; loan_label: Label { arguments { adb_top_attachment = DwtAttachOppWidget; adb_top_widget = Simple_Text loan_field; adb_top_offset = 2; adb_right_attachment = DwtAttachWidget; adb_right_widget = Simple_Text loan_field; adb_right_offset = 0; label_label = compound_string ('Loan (Principal) $'); }; }; rate_label: Label { arguments { adb_top_attachment = DwtAttachOppWidget; adb_top_widget = Simple_Text rate_field; adb_top_offset = 2; adb_right_attachment = DwtAttachWidget; adb_right_widget = Simple_Text rate_field; adb_right_offset = 0; label_label = compound_string ('Interest Rate'); }; }; rate_label_2: Label { arguments { adb_top_attachment = DwtAttachOppWidget; adb_top_widget = Label rate_label; adb_top_offset = 0; adb_left_attachment = DwtAttachWidget; adb_left_widget = Simple_Text rate_field; adb_left_offset = 0; label_label = compound_string ('% per annum'); }; }; qty_label: Label { arguments { adb_top_attachment = DwtAttachOppWidget; adb_top_widget = Simple_Text qty_field; adb_top_offset = 2; adb_right_attachment = DwtAttachWidget; adb_right_widget = Simple_Text qty_field; adb_right_offset = 0; label_label = compound_string ('Repayment per interval $'); }; }; repayment_interval: Option_Menu { arguments { adb_top_attachment = DwtAttachWidget; adb_top_widget = Simple_Text qty_field; adb_top_offset = input_y_offset; adb_left_attachment = DwtAttachOppWidget; adb_left_widget = Label qty_label; adb_left_offset = 0; label_label = compound_string ('Repayment Interval'); menu_history = Push_Button interval_monthly; }; controls { Pulldown_Menu interval_menu; }; }; Rep_Hist_Title: Label { arguments { adb_top_attachment = DwtAttachWidget; adb_top_widget = Option_Menu repayment_interval; adb_top_offset = hist_y_offset; adb_left_attachment = DwtAttachPosition; adb_left_position = 15; label_label = compound_string(" Interval Amount Total ",separate=true) & compound_string(" Number Outstanding Repaid "); border_width = 2; }; }; Repayment_History: List_Box { arguments { adb_top_attachment = DwtAttachWidget; adb_top_widget = Label rep_hist_title; adb_top_offset = -2; adb_left_attachment = DwtAttachOppWidget; adb_left_widget = Label rep_hist_title; adb_left_offset = 0; adb_right_attachment = DwtAttachOppWidget; adb_right_widget = Label rep_hist_title; adb_right_offset = 0; border_width = 2; visible_items_count = 5; font_argument = font_table(list_box_font); }; callbacks { create = procedure create_list_box (); }; }; Calculate_Button: Push_Button Widget { arguments { adb_top_attachment = DwtAttachWidget; adb_top_widget = List_Box Repayment_History; adb_top_offset = 30; adb_left_attachment = DwtAttachPosition; adb_left_position = 10; label_label = "Calculate"; border_highlight = True; }; callbacks { activate = procedure calculate_button_pressed (); }; }; Quit_Button: Push_Button { arguments { adb_top_attachment = DwtAttachOppWidget; adb_top_widget = Push_Button Calculate_Button; adb_top_offset = 0; adb_right_attachment = DwtAttachPosition; adb_right_position = 90; label_label = "Quit"; }; callbacks { activate = procedure Quit (); }; }; interval_menu: Pulldown_Menu { controls { Push_Button interval_weekly; Push_Button interval_fortnightly; Push_Button interval_monthly; Push_Button interval_bimonthly; Push_Button interval_quarterly; Push_Button interval_6monthly; Push_Button interval_yearly; }; }; interval_weekly: Push_Button { arguments { label_label = compound_string('Every Week'); }; callbacks { activate = procedure set_interval (k_interval_weekly); }; }; interval_fortnightly: Push_Button { arguments { label_label = compound_string('Every Fortnight'); }; callbacks { activate = procedure set_interval (k_interval_fortnightly); }; }; interval_monthly: Push_Button { arguments { label_label = compound_string('Every Month'); }; callbacks { activate = procedure set_interval (k_interval_monthly); }; }; interval_bimonthly: Push_Button { arguments { label_label = compound_string('Every Two Months'); }; callbacks { activate = procedure set_interval (k_interval_bimonthly); }; }; interval_quarterly: Push_Button { arguments { label_label = compound_string('Every Quarter'); }; callbacks { activate = procedure set_interval (k_interval_quarterly); }; }; interval_6monthly: Push_Button { arguments { label_label = compound_string('Every 6 Months'); }; callbacks { activate = procedure set_interval (k_interval_6monthly); }; }; interval_yearly: Push_Button { arguments { label_label = compound_string('Every Year'); }; callbacks { activate = procedure set_interval (k_interval_yearly); }; }; end module;