Revision: 7740
http://oorexx.svn.sourceforge.net/oorexx/?rev=7740&view=rev
Author: miesfeld
Date: 2012-04-07 19:54:55 +0000 (Sat, 07 Apr 2012)
Log Message:
-----------
ooDialog Samples - some file renaming
Added Paths:
-----------
main/trunk/samples/windows/oodialog/tutorial/employe10menuRc.rex
main/trunk/samples/windows/oodialog/tutorial/employe4validate.rex
main/trunk/samples/windows/oodialog/tutorial/employee11tab.h
main/trunk/samples/windows/oodialog/tutorial/employee11tab.rc
main/trunk/samples/windows/oodialog/tutorial/employee11tab.rex
Removed Paths:
-------------
main/trunk/samples/windows/oodialog/tutorial/employe10tab.rc
main/trunk/samples/windows/oodialog/tutorial/employe10tab.rex
main/trunk/samples/windows/oodialog/tutorial/employe4valid.rex
main/trunk/samples/windows/oodialog/tutorial/employe9menuRc.rex
Copied: main/trunk/samples/windows/oodialog/tutorial/employe10menuRc.rex (from rev 7739, main/trunk/samples/windows/oodialog/tutorial/employe9menuRc.rex)
===================================================================
--- main/trunk/samples/windows/oodialog/tutorial/employe10menuRc.rex (rev 0)
+++ main/trunk/samples/windows/oodialog/tutorial/employe10menuRc.rex 2012-04-07 19:54:55 UTC (rev 7740)
@@ -0,0 +1,297 @@
+/*----------------------------------------------------------------------------*/
+/* */
+/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
+/* Copyright (c) 2005-2012 Rexx Language Association. All rights reserved. */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the Common Public License v1.0 which accompanies this */
+/* distribution. A copy is also available at the following address: */
+/* http://www.oorexx.org/license.html */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the distribution. */
+/* */
+/* Neither the name of Rexx Language Association nor the names */
+/* of its contributors may be used to endorse or promote products */
+/* derived from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
+/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
+/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
+/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
+/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*----------------------------------------------------------------------------*/
+
+/**
+ * Name: employe9menuRc.rex
+ * Type: Open Object REXX Script
+ *
+ * Description: Adds a menu, obtained from the .rc script, to the Employees
+ * application. Continues the refinement / enhancement of the
+ * application.
+ */
+
+ .application~setDefaults('O', 'employe7.h', .false)
+
+ dlg = .MyDialogClass~new("employe7.rc", IDD_EMPLOYEES7)
+ if dlg~initCode <> 0 then return 99
+ dlg~execute("SHOWTOP")
+
+return 0
+
+
+::requires "ooDialog.cls"
+
+::class 'MyDialogClass' subclass RcDialog
+
+::attribute employees
+::attribute empCount
+
+::method init
+ expose menuBar
+
+ forward class (super) continue
+ if self~initCode <> 0 then return self~initCode
+
+ self~employees = .array~new(10)
+ self~empCount = 0
+
+ self~connectButtonEvent(IDC_PB_PRINT, "CLICKED", "onPrint")
+ self~connectButtonEvent(IDC_PB_ADD, "CLICKED", "onAdd")
+ self~connectButtonEvent(IDC_PB_LIST, "CLICKED", "onList")
+ self~connectButtonEvent(IDC_RB_ADD, "CLICKED", "onAdding")
+ self~connectButtonEvent(IDC_RB_BROWSE, "CLICKED", "onBrowsing")
+
+ self~connectEditEvent(IDC_EDIT_NAME, "CHANGE", onNameChange)
+ self~connectUpDownEvent(IDC_UPD, "DELTAPOS", onEmpChange)
+
+ menuBar = .ScriptMenuBar~new("employe7.rc", IDM_MENUBAR, 0)
+ menuBar~connectCommandEvent(IDM_ADD, "onAdd", self)
+ menuBar~connectCommandEvent(IDM_PRINT, "onPrint", self)
+ menuBar~connectCommandEvent(IDM_LIST, "onList", self)
+ menuBar~connectCommandEvent(IDM_ABOUT, "about", self)
+
+ return self~initCode
+
+::method initDialog
+ expose cbCity lbPosition menuBar
+
+ cbCity = self~newComboBox(IDC_CB_CITY)
+ cbCity~add("Munich")
+ cbCity~add("New York")
+ cbCity~add("San Francisco")
+ cbCity~add("Stuttgart")
+ cbCity~add("San Diego")
+ cbCity~add("Tucson")
+ cbCity~add("Houston")
+ cbCity~add("Las Angles")
+
+ lbPosition = self~newListBox(IDC_LB_POSITION)
+ lbPosition~add("Business Manager")
+ lbPosition~add("Engineering Manager")
+ lbPosition~add("Software Developer")
+ lbPosition~add("Software QA")
+ lbPosition~add("Accountant")
+ lbPosition~add("Security")
+ lbPosition~add("Secretary")
+ lbPosition~add("Recptionist")
+ lbPosition~add("Lab Manager")
+ lbPosition~add("Lawyer")
+ lbPosition~add("CEO")
+
+ menuBar~attachTo(self, 1)
+
+ self~setControls
+ self~defaultForm
+
+
+::method onPrint
+ expose cbCity lbPosition rbMale chkMarried editName
+
+ title = "Acme Software - Employee:"
+
+ if rbMale~checked then msg = "Mr."
+ else msg = "Ms."
+ msg ||= editName~getText
+
+ if chkMarried~checked then msg ||= " (married) "
+ msg ||= "A"x || "City:" cbCity~selected || "A"x || "Profession:" lbPosition~selected
+
+ j = MessageDialog(msg, self~hwnd, title, , INFORMATION)
+
+::method onAdd
+ expose cbCity lbPosition rbMale chkMarried editName pbList upDown rbBrowse
+
+ self~empCount += 1
+ self~employees[self~empCount] = .directory~new
+ self~employees[self~empCount]['NAME'] = editName~getText
+ self~employees[self~empCount]['CITY'] = cbCity~selected
+ self~employees[self~empCount]['POSITION'] = lbPosition~selected
+
+ if rbMale~checked then sex = 1
+ else sex = 2
+
+ self~employees[self~empCount]['SEX'] = sex
+ self~employees[self~empCount]['MARRIED'] = chkMarried~checked
+
+ upDown~setRange(1, self~empCount)
+ if self~empCount == 1 then do
+ rbBrowse~enable
+ upDown~setPosition(1)
+ end
+
+ self~defaultForm
+
+::method onNameChange
+ expose menuBar editName rbAdd pbAdd pbPrint
+
+ if rbAdd~checked then do
+ if editName~getText~strip~length == 0 then do
+ pbAdd~disable
+ pbPrint~disable
+ menuBar~disable(IDM_ADD)
+ menuBar~disable(IDM_PRINT)
+ end
+ else do
+ pbAdd~enable
+ pbPrint~enable
+ menuBar~enable(IDM_ADD)
+ menuBar~enable(IDM_PRINT)
+ end
+ end
+
+::method onEmpChange
+ use arg curPos, increment
+
+ self~setEmpRecord(curPos + increment)
+ return .UpDown~deltaPosReply
+
+::method onAdding
+ self~defaultForm
+
+::method onBrowsing
+ expose upDown pbAdd menuBar
+
+ pbAdd~disable
+ menuBar~disable(IDM_ADD)
+ upDown~enable
+ self~setEmpRecord(upDown~getPosition)
+
+::method setEmpRecord
+ expose upDown editName cbCity lbPosition rbMale rbFemale chkMarried
+ use strict arg emp
+
+ if emp < 1 then return self~noRecord('bottom')
+ else if emp > upDown~getRange~max then return self~noRecord('top')
+
+ editName~setText(self~employees[emp]['NAME'])
+
+ cbCity~select(self~employees[emp]['CITY'])
+ lbPosition~select(self~employees[emp]['POSITION'])
+
+ if self~employees[emp]['SEX'] = 1 then do
+ rbMale~check
+ rbFemale~uncheck
+ end
+ else do
+ rbFemale~check
+ rbMale~uncheck
+ end
+
+ if self~employees[emp]['MARRIED'] then chkMarried~check
+ else chkMarried~uncheck
+
+
+::method onList
+ lDlg = .EmployeeListClass~new("employe7.rc", IDD_EMPLOYEE_LIST)
+ lDlg~parent = self
+ lDlg~execute("SHOWTOP")
+
+
+::method fillList
+ use strict arg list
+ do id = 1 to self~empCount
+ if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms."
+ addstring = title self~employees[id]['NAME']
+ addstring = addstring || "9"x || self~employees[id]['POSITION']
+ addstring = addstring || "9"x || self~employees[id]['CITY']
+ list~insert(id, addstring)
+ end
+
+::method about
+ call infoDialog "Sample to demonstrate ooDialog menus."
+
+::method setControls private
+ expose rbMale rbFemale rbAdd rbBrowse chkMarried editName pbList pbAdd pbPrint upDown
+
+ pbAdd = self~newPushButton(IDC_PB_ADD)
+ pbList = self~newPushButton(IDC_PB_LIST)
+ pbPrint = self~newPushButton(IDC_PB_PRINT)
+ rbMale = self~newRadioButton(IDC_RB_MALE)
+ rbFemale = self~newRadioButton(IDC_RB_FEMALE)
+ rbAdd = self~newRadioButton(IDC_RB_ADD)
+ rbBrowse = self~newRadioButton(IDC_RB_BROWSE)
+ chkMarried = self~newCheckBox(IDC_CHK_MARRIED)
+ editName = self~newEdit(IDC_EDIT_NAME)
+ upDown = self~newUpDown(IDC_UPD)
+
+::method defaultForm private
+ expose menuBar cbCity lbPosition rbMale rbFemale rbAdd rbBrowse chkMarried -
+ editName pbAdd pbList pbPrint upDown
+
+ editName~setText("")
+ cbCity~select("New York")
+ lbPosition~select("Software Developer")
+
+ rbMale~check
+ rbFemale~uncheck
+ chkMarried~uncheck
+
+ rbAdd~check
+ pbAdd~disable
+ pbPrint~disable
+ menuBar~disable(IDM_ADD)
+ menuBar~disable(IDM_PRINT)
+ upDown~disable
+
+ editName~assignFocus
+
+ if self~empCount < 1 then do
+ pbList~disable
+ rbBrowse~disable
+ upDown~setRange(0, 0)
+ upDown~setPosition(0)
+ end
+ else do
+ pbList~enable
+ menuBar~enable(IDM_LIST)
+ end
+
+::method noRecord private
+ use strict arg direction
+ return MessageDialog('At the' direction 'of the records', self~hwnd, -
+ 'Employee Records')
+
+
+::class 'EmployeeListClass' subclass RcDialog
+
+::attribute parent
+
+::method initDialog
+ lb = self~newListBox(IDC_LB_EMPLOYEES_LIST)
+ self~parent~fillList(lb)
+ lb~setTabulators(90, 190)
Deleted: main/trunk/samples/windows/oodialog/tutorial/employe10tab.rc
===================================================================
--- main/trunk/samples/windows/oodialog/tutorial/employe10tab.rc 2012-04-07 19:41:12 UTC (rev 7739)
+++ main/trunk/samples/windows/oodialog/tutorial/employe10tab.rc 2012-04-07 19:54:55 UTC (rev 7740)
@@ -1,90 +0,0 @@
-// Generated by ResEdit 1.5.10
-// Copyright (C) 2006-2012
-// http://www.resedit.net
-
-#include <windows.h>
-#include <winuser.h>
-#include <commctrl.h>
-#include "employe10tab.h"
-
-
-
-
-//
-// Dialog resources
-//
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-IDD_EMPLOYEES_ADD DIALOG 0, 0, 227, 160
-STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP
-CAPTION "Add Employees"
-FONT 10, "Tahoma"
-{
- LTEXT "Person:", -1, 12, 20, 30, 8, SS_LEFT
- EDITTEXT IDC_EDIT_NAME_A, 40, 20, 102, 12
- LTEXT "City:", -1, 12, 37, 16, 8, SS_LEFT
- COMBOBOX IDC_CB_CITY_A, 40, 37, 102, 56, WS_TABSTOP | CBS_DROPDOWNLIST
- LTEXT "Position:", -1, 12, 58, 30, 8, SS_LEFT
- LISTBOX IDC_LB_POSITION_A, 10, 68, 132, 82, WS_TABSTOP | WS_VSCROLL | LBS_SORT | LBS_NOTIFY
- GROUPBOX "Statistics", IDC_GB1, 153, 20, 64, 80, WS_GROUP
- AUTORADIOBUTTON "&Male", IDC_RB_MALE_A, 161, 31, 40, 12, WS_TABSTOP
- AUTORADIOBUTTON "&Female", IDC_RB_FEMALE_A, 161, 46, 40, 12
- AUTOCHECKBOX "Ma&rried", IDC_CHK_MARRIED_A, 161, 63, 40, 12, WS_GROUP
- AUTOCHECKBOX "Full Time", IDC_CHK_FULLTIME_A, 161, 82, 40, 12, WS_GROUP
- PUSHBUTTON "Print", IDC_PB_PRINT_A, 167, 136, 50, 14
-}
-
-
-
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-IDD_EMPLOYEES_BROWSE DIALOG 0, 0, 227, 160
-STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP
-CAPTION "Browse Employees"
-FONT 10, "Tahoma"
-{
- LTEXT "Person:", -1, 12, 20, 30, 8, SS_LEFT
- EDITTEXT IDC_EDIT_NAME_B, 40, 20, 102, 12, ES_READONLY
- CONTROL "", IDC_UPD, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY, 132, 20, 10, 12
- LTEXT "City:", -1, 12, 37, 16, 8, SS_LEFT
- COMBOBOX IDC_CB_CITY_B, 40, 37, 102, 56, WS_TABSTOP | WS_DISABLED | CBS_DROPDOWNLIST
- LTEXT "Position:", -1, 12, 58, 30, 8, SS_LEFT
- LISTBOX IDC_LB_POSITION_B, 10, 68, 132, 82, WS_TABSTOP | WS_VSCROLL | WS_DISABLED | LBS_SORT | LBS_NOTIFY
- GROUPBOX "Statistics", IDC_GB1, 153, 20, 64, 80, WS_GROUP
- AUTORADIOBUTTON "&Male", IDC_RB_MALE_B, 161, 31, 40, 12, WS_TABSTOP | WS_DISABLED
- AUTORADIOBUTTON "&Female", IDC_RB_FEMALE_B, 161, 46, 40, 12, WS_DISABLED
- AUTOCHECKBOX "Ma&rried", IDC_CHK_MARRIED_B, 161, 63, 40, 12, WS_GROUP | WS_DISABLED
- AUTOCHECKBOX "Full Time", IDC_CHK_FULLTIME_B, 161, 82, 40, 12, WS_GROUP | WS_DISABLED
- PUSHBUTTON "Print", IDC_PB_PRINT_E1, 167, 136, 50, 14
-}
-
-
-
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-IDD_EMPLOYEES_EDIT DIALOG 0, 0, 227, 160
-STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP
-CAPTION "Edit Employees"
-FONT 10, "Tahoma"
-{
- LTEXT "Person:", -1, 12, 20, 30, 8, SS_LEFT
- EDITTEXT IDC_EDIT_NAME_E, 40, 20, 102, 12
- LTEXT "City:", -1, 12, 37, 16, 8, SS_LEFT
- COMBOBOX IDC_CB_CITY_E, 40, 37, 102, 56, WS_TABSTOP | CBS_DROPDOWNLIST
- LTEXT "Position:", -1, 12, 58, 30, 8, SS_LEFT
- LISTBOX IDC_LB_POSITION_E, 10, 68, 132, 82, WS_TABSTOP | WS_VSCROLL | LBS_SORT | LBS_NOTIFY
- GROUPBOX "Statistics", IDC_GB1, 153, 20, 64, 80, WS_GROUP
- AUTORADIOBUTTON "&Male", IDC_RB_MALE_E, 161, 31, 40, 12, WS_TABSTOP
- AUTORADIOBUTTON "&Female", IDC_RB_FEMALE_E, 161, 46, 40, 12
- AUTOCHECKBOX "Ma&rried", IDC_CHK_MARRIED_E, 161, 63, 40, 12, WS_GROUP
- AUTOCHECKBOX "Full Time", IDC_CHK_FULLTIME_E, 161, 82, 40, 12, WS_GROUP
- PUSHBUTTON "Print", IDC_PB_PRINT_E, 167, 136, 50, 14
-}
-
-
-
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-IDD_EMPLOYEES_LIST DIALOG 0, 0, 227, 160
-STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP
-CAPTION "List Employees"
-FONT 10, "Tahoma"
-{
- CONTROL "", IDC_LV_EMPLOYEES, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT, 10, 10, 207, 140
-}
Deleted: main/trunk/samples/windows/oodialog/tutorial/employe10tab.rex
===================================================================
--- main/trunk/samples/windows/oodialog/tutorial/employe10tab.rex 2012-04-07 19:41:12 UTC (rev 7739)
+++ main/trunk/samples/windows/oodialog/tutorial/employe10tab.rex 2012-04-07 19:54:55 UTC (rev 7740)
@@ -1,752 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* */
-/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
-/* Copyright (c) 2005-2012 Rexx Language Association. All rights reserved. */
-/* */
-/* This program and the accompanying materials are made available under */
-/* the terms of the Common Public License v1.0 which accompanies this */
-/* distribution. A copy is also available at the following address: */
-/* http://www.oorexx.org/license.html */
-/* */
-/* Redistribution and use in source and binary forms, with or */
-/* without modification, are permitted provided that the following */
-/* conditions are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* Redistributions in binary form must reproduce the above copyright */
-/* notice, this list of conditions and the following disclaimer in */
-/* the documentation and/or other materials provided with the distribution. */
-/* */
-/* Neither the name of Rexx Language Association nor the names */
-/* of its contributors may be used to endorse or promote products */
-/* derived from this software without specific prior written permission. */
-/* */
-/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
-/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
-/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
-/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
-/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
-/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
-/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
-/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/*----------------------------------------------------------------------------*/
-/****************************************************************************/
-/* Name: EM_CATEG.REX */
-/* Type: Object REXX Script */
-/* */
-/* Description: Sample to demonstrate the category dialog class */
-/* */
-/****************************************************************************/
-
-/**
- * Name: employe10tab.rex
- * Type: Open Object REXX Script
- *
- * Description: Example to demonstrate the property sheet dialog class.
- */
-
- -- Note to self, we do not use data attributes in this app, need explanation.
- .application~setDefaults("O", "employe10tab.h", .false)
-
- -- Create the dialog pages.
- p1 = .EmployeeAdd~new("employe10tab.rc", IDD_EMPLOYEES_ADD)
- p2 = .EmployeeEdit~new("employe10tab.rc", IDD_EMPLOYEES_EDIT)
- p3 = .EmployeeBrowse~new("employe10tab.rc", IDD_EMPLOYEES_BROWSE)
- p4 = .EmployeeList~new("employe10tab.rc", IDD_EMPLOYEES_LIST)
-
- pages = .array~of(p1, p2, p3, p4)
- dlg = .AcmeEmployeesDlg~new(pages, "", "Acme Software - Employee Manager Version 10.00.0")
-
- dlg~execute
-
- return 0
-
-::requires "ooDialog.cls"
-
-
-::class 'AcmeEmployeesDlg' subclass PropertySheetDialog
-
-::attribute employees
-::attribute empCount
-::attribute empIndex
-
-::method init
- forward class (super) continue
- --say 'In' self 'init()'
-
- -- need to get employees from database
- self~employees = .array~new(10)
- self~empCount = 0
- self~empIndex = 0
-
-
- --say 'Pages:'
- do d over self~pages
- --say ' ' d
- d~configure(self~employees, self~empCount, self~empIndex)
- end
-
-::method initDialog
-
- say 'In' self 'initDialog()'
-
-::class 'EmployeeAdd' subclass RcPSPDialog
-
-::attribute employees
-::attribute empCount
-::attribute empIndex
-
-::method configure
- use arg employees, count
-
- self~employees = employess
- self~empCount = count
-
- self~connectEditEvent(IDC_EDIT_NAME_A, "CHANGE", onNameChange)
- say 'In' self 'configure() propSheet?' self~propSheet
-
-::method initDialog
- expose cbCity lbPosition
-
- say 'In' self 'init() self~propSheet?' self~propSheet
- self~setControls
-
- cbCity~add("Munich")
- cbCity~add("New York")
- cbCity~add("San Francisco")
- cbCity~add("Stuttgart")
- cbCity~add("San Diego")
- cbCity~add("Tucson")
- cbCity~add("Houston")
- cbCity~add("Las Angles")
-
- lbPosition~add("Business Manager")
- lbPosition~add("Engineering Manager")
- lbPosition~add("Software Developer")
- lbPosition~add("Software QA")
- lbPosition~add("Accountant")
- lbPosition~add("Security")
- lbPosition~add("Secretary")
- lbPosition~add("Recptionist")
- lbPosition~add("Lab Manager")
- lbPosition~add("Lawyer")
- lbPosition~add("CEO")
-
- self~defaultForm
-
-
-::method setActive unguarded
-
- self~defaultForm
- return 0
-
-::method killActive unguarded
- use arg psDlg
-
- say 'leaving will abandon changes'
- return .true
-
-::method onPrint
- expose cbCity lbPosition rbMale chkMarried editName
-
- title = "Acme Software - Employee:"
-
- if rbMale~checked then msg = "Mr."
- else msg = "Ms."
- msg ||= editName~getText
-
- if chkMarried~checked then msg ||= " (married) "
- msg ||= "A"x || "City:" cbCity~selected || "A"x || "Profession:" lbPosition~selected
-
- j = MessageDialog(msg, self~hwnd, title, , INFORMATION)
-
-::method onAdd
- expose cbCity lbPosition rbMale chkMarried editName pbList upDown rbBrowse
-
- self~empCount += 1
- self~employees[self~empCount] = .directory~new
- self~employees[self~empCount]['NAME'] = editName~getText
- self~employees[self~empCount]['CITY'] = cbCity~selected
- self~employees[self~empCount]['POSITION'] = lbPosition~selected
-
- if rbMale~checked then sex = 1
- else sex = 2
-
- self~employees[self~empCount]['SEX'] = sex
- self~employees[self~empCount]['MARRIED'] = chkMarried~checked
-
- upDown~setRange(1, self~empCount)
- if self~empCount == 1 then do
- rbBrowse~enable
- upDown~setPosition(1)
- end
-
- self~defaultForm
-
-::method onNameChange
- expose editName
- say 'NEED TO DO SOMETHING HERE'
- /*
- if rbAdd~checked then do
- if editName~getText~strip~length == 0 then do
- pbAdd~disable
- pbPrint~disable
- menuBar~disable(IDM_ADD)
- menuBar~disable(IDM_PRINT)
- end
- else do
- pbAdd~enable
- pbPrint~enable
- menuBar~enable(IDM_ADD)
- menuBar~enable(IDM_PRINT)
- end
- end
- */
-
-::method onEmpChange
- use arg curPos, increment
-
- self~setEmpRecord(curPos + increment)
- return .UpDown~deltaPosReply
-
-::method onAdding
- self~defaultForm
-
-::method onBrowsing
- expose upDown pbAdd menuBar
-
- pbAdd~disable
- menuBar~disable(IDM_ADD)
- upDown~enable
- self~setEmpRecord(upDown~getPosition)
-
-::method setEmpRecord
- expose upDown editName cbCity lbPosition rbMale rbFemale chkMarried
- use strict arg emp
-
- if emp < 1 then return self~noRecord('bottom')
- else if emp > upDown~getRange~max then return self~noRecord('top')
-
- editName~setText(self~employees[emp]['NAME'])
-
- cbCity~select(self~employees[emp]['CITY'])
- lbPosition~select(self~employees[emp]['POSITION'])
-
- if self~employees[emp]['SEX'] = 1 then do
- rbMale~check
- rbFemale~uncheck
- end
- else do
- rbFemale~check
- rbMale~uncheck
- end
-
- if self~employees[emp]['MARRIED'] then chkMarried~check
- else chkMarried~uncheck
-
-
-::method onList
- lDlg = .EmployeeListClass~new("employe7.rc", IDD_EMPLOYEE_LIST)
- lDlg~parent = self
- lDlg~execute("SHOWTOP")
-
-
-::method fillList
- use strict arg list
- do id = 1 to self~empCount
- if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms."
- addstring = title self~employees[id]['NAME']
- addstring = addstring || "9"x || self~employees[id]['POSITION']
- addstring = addstring || "9"x || self~employees[id]['CITY']
- list~insert(id, addstring)
- end
-
-::method about
- call infoDialog "Sample to demonstrate ooDialog menus."
-
-::method setControls private
- expose cbCity lbPosition rbMale rbFemale chkMarried chkFullTime editName
-
- cbCity = self~newComboBox(IDC_CB_CITY_A)
- lbPosition = self~newListBox(IDC_LB_POSITION_A)
- rbMale = self~newRadioButton(IDC_RB_MALE_A)
- rbFemale = self~newRadioButton(IDC_RB_FEMALE_A)
- chkMarried = self~newCheckBox(IDC_CHK_MARRIED_A)
- chkFullTime = self~newCheckBox(IDC_CHK_FULLTIME_A)
- editName = self~newEdit(IDC_EDIT_NAME_A)
-
-::method defaultForm private
- expose cbCity lbPosition rbMale rbFemale chkMarried chkFullTime editName
- say 'In defaultForm()'
- editName~setText("")
- cbCity~select("New York")
- lbPosition~select("Software Developer")
-
- rbMale~check
- rbFemale~uncheck
- chkMarried~uncheck
- chkFullTime~check
-
- editName~assignFocus
-
- /*
- if self~empCount < 1 then do
- pbList~disable
- rbBrowse~disable
- upDown~setRange(0, 0)
- upDown~setPosition(0)
- end
- else do
- pbList~enable
- menuBar~enable(IDM_LIST)
- end
- */
-
-::method noRecord private
- use strict arg direction
- return MessageDialog('At the' direction 'of the records', self~hwnd, -
- 'Employee Records')
-
-
-
-::class 'EmployeeEdit' subclass RcPSPDialog
-
-::attribute employees
-::attribute empCount
-::attribute empIndex
-
-::method configure
- use arg employees, count
-
- self~employees = employess
- self~empCount = count
-
- self~connectEditEvent(IDC_EDIT_NAME_A, "CHANGE", onNameChange)
- say 'In' self 'configure() propSheet?' self~propSheet
-
-::method initDialog
- expose cbCity lbPosition
-
- self~setControls
-
- cbCity~add("Munich")
- cbCity~add("New York")
- cbCity~add("San Francisco")
- cbCity~add("Stuttgart")
- cbCity~add("San Diego")
- cbCity~add("Tucson")
- cbCity~add("Houston")
- cbCity~add("Las Angles")
-
- lbPosition~add("Business Manager")
- lbPosition~add("Engineering Manager")
- lbPosition~add("Software Developer")
- lbPosition~add("Software QA")
- lbPosition~add("Accountant")
- lbPosition~add("Security")
- lbPosition~add("Secretary")
- lbPosition~add("Recptionist")
- lbPosition~add("Lab Manager")
- lbPosition~add("Lawyer")
- lbPosition~add("CEO")
-
-
-
-::method onPrint
- expose cbCity lbPosition rbMale chkMarried editName
-
- title = "Acme Software - Employee:"
-
- if rbMale~checked then msg = "Mr."
- else msg = "Ms."
- msg ||= editName~getText
-
- if chkMarried~checked then msg ||= " (married) "
- msg ||= "A"x || "City:" cbCity~selected || "A"x || "Profession:" lbPosition~selected
-
- j = MessageDialog(msg, self~hwnd, title, , INFORMATION)
-
-::method onAdd
- expose cbCity lbPosition rbMale chkMarried editName pbList upDown rbBrowse
-
- self~empCount += 1
- self~employees[self~empCount] = .directory~new
- self~employees[self~empCount]['NAME'] = editName~getText
- self~employees[self~empCount]['CITY'] = cbCity~selected
- self~employees[self~empCount]['POSITION'] = lbPosition~selected
-
- if rbMale~checked then sex = 1
- else sex = 2
-
- self~employees[self~empCount]['SEX'] = sex
- self~employees[self~empCount]['MARRIED'] = chkMarried~checked
-
- upDown~setRange(1, self~empCount)
- if self~empCount == 1 then do
- rbBrowse~enable
- upDown~setPosition(1)
- end
-
- self~defaultForm
-
-::method onNameChange
- expose menuBar editName rbAdd pbAdd pbPrint
-
- if rbAdd~checked then do
- if editName~getText~strip~length == 0 then do
- pbAdd~disable
- pbPrint~disable
- menuBar~disable(IDM_ADD)
- menuBar~disable(IDM_PRINT)
- end
- else do
- pbAdd~enable
- pbPrint~enable
- menuBar~enable(IDM_ADD)
- menuBar~enable(IDM_PRINT)
- end
- end
-
-::method onEmpChange
- use arg curPos, increment
-
- self~setEmpRecord(curPos + increment)
- return .UpDown~deltaPosReply
-
-::method onAdding
- self~defaultForm
-
-::method onBrowsing
- expose upDown pbAdd menuBar
-
- pbAdd~disable
- menuBar~disable(IDM_ADD)
- upDown~enable
- self~setEmpRecord(upDown~getPosition)
-
-::method setEmpRecord
- expose upDown editName cbCity lbPosition rbMale rbFemale chkMarried
- use strict arg emp
-
- if emp < 1 then return self~noRecord('bottom')
- else if emp > upDown~getRange~max then return self~noRecord('top')
-
- editName~setText(self~employees[emp]['NAME'])
-
- cbCity~select(self~employees[emp]['CITY'])
- lbPosition~select(self~employees[emp]['POSITION'])
-
- if self~employees[emp]['SEX'] = 1 then do
- rbMale~check
- rbFemale~uncheck
- end
- else do
- rbFemale~check
- rbMale~uncheck
- end
-
- if self~employees[emp]['MARRIED'] then chkMarried~check
- else chkMarried~uncheck
-
-
-::method fillList
- use strict arg list
- do id = 1 to self~empCount
- if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms."
- addstring = title self~employees[id]['NAME']
- addstring = addstring || "9"x || self~employees[id]['POSITION']
- addstring = addstring || "9"x || self~employees[id]['CITY']
- list~insert(id, addstring)
- end
-
-::method about
- call infoDialog "Sample to demonstrate ooDialog menus."
-
-::method setControls private
- expose cbCity lbPosition rbMale rbFemale chkMarried chkFullTime editName
-
- cbCity = self~newComboBox(IDC_CB_CITY_E)
- lbPosition = self~newListBox(IDC_LB_POSITION_E)
- rbMale = self~newRadioButton(IDC_RB_MALE_E)
- rbFemale = self~newRadioButton(IDC_RB_FEMALE_E)
- chkMarried = self~newCheckBox(IDC_CHK_MARRIED_E)
- editName = self~newEdit(IDC_EDIT_NAME_E)
-
-::method defaultForm private
- expose menuBar cbCity lbPosition rbMale rbFemale rbAdd rbBrowse chkMarried -
- editName pbAdd pbList pbPrint upDown
-
- editName~setText("")
- cbCity~select("New York")
- lbPosition~select("Software Developer")
-
- rbMale~check
- rbFemale~uncheck
- chkMarried~uncheck
-
- rbAdd~check
- pbAdd~disable
- pbPrint~disable
- menuBar~disable(IDM_ADD)
- menuBar~disable(IDM_PRINT)
- upDown~disable
-
- editName~assignFocus
-
- if self~empCount < 1 then do
- pbList~disable
- rbBrowse~disable
- upDown~setRange(0, 0)
- upDown~setPosition(0)
- end
- else do
- pbList~enable
- menuBar~enable(IDM_LIST)
- end
-
-::method noRecord private
- use strict arg direction
- return MessageDialog('At the' direction 'of the records', self~hwnd, -
- 'Employee Records')
-
-
-
-::class 'EmployeeBrowse' subclass RcPSPDialog
-
-::attribute employees
-::attribute empCount
-::attribute empIndex
-
-::method configure
- use arg employees, count, empIndex
-
- self~employees = employess
- self~empCount = count
- self~empIndex = empIndex
-
- say 'In' self 'configure() propSheet?' self~propSheet
-
-::method initDialog
- expose cbCity lbPosition
-
- cbCity = self~newComboBox(IDC_CB_CITY_B)
- cbCity~add("Munich")
- cbCity~add("New York")
- cbCity~add("San Francisco")
- cbCity~add("Stuttgart")
- cbCity~add("San Diego")
- cbCity~add("Tucson")
- cbCity~add("Houston")
- cbCity~add("Las Angles")
-
- lbPosition = self~newListBox(IDC_LB_POSITION_B)
- lbPosition~add("Business Manager")
- lbPosition~add("Engineering Manager")
- lbPosition~add("Software Developer")
- lbPosition~add("Software QA")
- lbPosition~add("Accountant")
- lbPosition~add("Security")
- lbPosition~add("Secretary")
- lbPosition~add("Recptionist")
- lbPosition~add("Lab Manager")
- lbPosition~add("Lawyer")
- lbPosition~add("CEO")
-
- self~setControls
-
-
-::method onPrint
- expose cbCity lbPosition rbMale chkMarried editName
-
- title = "Acme Software - Employee:"
-
- if rbMale~checked then msg = "Mr."
- else msg = "Ms."
- msg ||= editName~getText
-
- if chkMarried~checked then msg ||= " (married) "
- msg ||= "A"x || "City:" cbCity~selected || "A"x || "Profession:" lbPosition~selected
-
- j = MessageDialog(msg, self~hwnd, title, , INFORMATION)
-
-::method onAdd
- expose cbCity lbPosition rbMale chkMarried editName pbList upDown rbBrowse
-
- self~empCount += 1
- self~employees[self~empCount] = .directory~new
- self~employees[self~empCount]['NAME'] = editName~getText
- self~employees[self~empCount]['CITY'] = cbCity~selected
- self~employees[self~empCount]['POSITION'] = lbPosition~selected
-
- if rbMale~checked then sex = 1
- else sex = 2
-
- self~employees[self~empCount]['SEX'] = sex
- self~employees[self~empCount]['MARRIED'] = chkMarried~checked
-
- upDown~setRange(1, self~empCount)
- if self~empCount == 1 then do
- rbBrowse~enable
- upDown~setPosition(1)
- end
-
- self~defaultForm
-
-::method onNameChange
- expose menuBar editName rbAdd pbAdd pbPrint
-
- if rbAdd~checked then do
- if editName~getText~strip~length == 0 then do
- pbAdd~disable
- pbPrint~disable
- menuBar~disable(IDM_ADD)
- menuBar~disable(IDM_PRINT)
- end
- else do
- pbAdd~enable
- pbPrint~enable
- menuBar~enable(IDM_ADD)
- menuBar~enable(IDM_PRINT)
- end
- end
-
-::method onEmpChange
- use arg curPos, increment
-
- self~setEmpRecord(curPos + increment)
- return .UpDown~deltaPosReply
-
-::method onAdding
- self~defaultForm
-
-::method onBrowsing
- expose upDown pbAdd menuBar
-
- pbAdd~disable
- menuBar~disable(IDM_ADD)
- upDown~enable
- self~setEmpRecord(upDown~getPosition)
-
-::method setEmpRecord
- expose upDown editName cbCity lbPosition rbMale rbFemale chkMarried
- use strict arg emp
-
- if emp < 1 then return self~noRecord('bottom')
- else if emp > upDown~getRange~max then return self~noRecord('top')
-
- editName~setText(self~employees[emp]['NAME'])
-
- cbCity~select(self~employees[emp]['CITY'])
- lbPosition~select(self~employees[emp]['POSITION'])
-
- if self~employees[emp]['SEX'] = 1 then do
- rbMale~check
- rbFemale~uncheck
- end
- else do
- rbFemale~check
- rbMale~uncheck
- end
-
- if self~employees[emp]['MARRIED'] then chkMarried~check
- else chkMarried~uncheck
-
-
-::method onList
- lDlg = .EmployeeListClass~new("employe7.rc", IDD_EMPLOYEE_LIST)
- lDlg~parent = self
- lDlg~execute("SHOWTOP")
-
-
-::method fillList
- use strict arg list
- do id = 1 to self~empCount
- if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms."
- addstring = title self~employees[id]['NAME']
- addstring = addstring || "9"x || self~employees[id]['POSITION']
- addstring = addstring || "9"x || self~employees[id]['CITY']
- list~insert(id, addstring)
- end
-
-::method setControls private
- expose cbCity lbPosition rbMale rbFemale chkMarried chkFullTime editName
-
- cbCity = self~newComboBox(IDC_CB_CITY_B)
- lbPosition = self~newListBox(IDC_LB_POSITION_B)
- rbMale = self~newRadioButton(IDC_RB_MALE_B)
- rbFemale = self~newRadioButton(IDC_RB_FEMALE_B)
- chkMarried = self~newCheckBox(IDC_CHK_MARRIED_B)
- editName = self~newEdit(IDC_EDIT_NAME_B)
-
-::method defaultForm private
- expose menuBar cbCity lbPosition rbMale rbFemale rbAdd rbBrowse chkMarried -
- editName pbAdd pbList pbPrint upDown
-
- editName~setText("")
- cbCity~select("New York")
- lbPosition~select("Software Developer")
-
- rbMale~check
- rbFemale~uncheck
- chkMarried~uncheck
-
- rbAdd~check
- pbAdd~disable
- pbPrint~disable
- menuBar~disable(IDM_ADD)
- menuBar~disable(IDM_PRINT)
- upDown~disable
-
- editName~assignFocus
-
- if self~empCount < 1 then do
- pbList~disable
- rbBrowse~disable
- upDown~setRange(0, 0)
- upDown~setPosition(0)
- end
- else do
- pbList~enable
- menuBar~enable(IDM_LIST)
- end
-
-::method noRecord private
- use strict arg direction
- return MessageDialog('At the' direction 'of the records', self~hwnd, -
- 'Employee Records')
-
-
-
-::class 'EmployeeList' subclass RcPSPDialog
-
-::attribute employees
-::attribute empCount
-::attribute empIndex
-
-::method configure
- use arg employees, count
-
- self~employees = employess
- self~empCount = count
-
- say 'In' self 'configure() propSheet?' self~propSheet
-
-::method initDialog
- say 'In' self 'initDialog() need to fill listview'
-
-::method fillList
- use strict arg list
-
- do id = 1 to self~empCount
- if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms."
- addstring = title self~employees[id]['NAME']
- addstring = addstring || "9"x || self~employees[id]['POSITION']
- addstring = addstring || "9"x || self~employees[id]['CITY']
- list~insert(id, addstring)
- end
-
Deleted: main/trunk/samples/windows/oodialog/tutorial/employe4valid.rex
===================================================================
--- main/trunk/samples/windows/oodialog/tutorial/employe4valid.rex 2012-04-07 19:41:12 UTC (rev 7739)
+++ main/trunk/samples/windows/oodialog/tutorial/employe4valid.rex 2012-04-07 19:54:55 UTC (rev 7740)
@@ -1,83 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* */
-/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
-/* Copyright (c) 2005-2012 Rexx Language Association. All rights reserved. */
-/* */
-/* This program and the accompanying materials are made available under */
-/* the terms of the Common Public License v1.0 which accompanies this */
-/* distribution. A copy is also available at the following address: */
-/* http://www.oorexx.org/license.html */
-/* */
-/* Redistribution and use in source and binary forms, with or */
-/* without modification, are permitted provided that the following */
-/* conditions are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* Redistributions in binary form must reproduce the above copyright */
-/* notice, this list of conditions and the following disclaimer in */
-/* the documentation and/or other materials provided with the distribution. */
-/* */
-/* Neither the name of Rexx Language Association nor the names */
-/* of its contributors may be used to endorse or promote products */
-/* derived from this software without specific prior written permission. */
-/* */
-/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
-/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
-/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
-/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
-/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
-/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
-/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
-/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/*----------------------------------------------------------------------------*/
-
-/**
- * Name: employe4valid.rex
- * Type: Open Object REXX Script
- */
-
-dlg = .MyDialogClass~new("employe2.rc", 100)
-if dlg~initCode <> 0 then exit
-
-dlg~execute("SHOWTOP")
-
-::requires "ooDialog.cls"
-
-::class MyDialogClass subclass RcDialog
-::method initDialog
- self~city = "New York"
- self~male = 1
- self~female = 0
- self~addComboEntry(22, "Munich")
- self~addComboEntry(22, "New York")
- self~addComboEntry(22, "San Francisco")
- self~addComboEntry(22, "Stuttgart")
- self~addListEntry(23, "Business Manager")
- self~addListEntry(23, "Software Developer")
- self~addListEntry(23, "Broker")
- self~addListEntry(23, "Police Man")
- self~addListEntry(23, "Lawyer")
- self~connectButtonEvent(10, "CLICKED", "Print") /* connect button 10 with a method */
-
-::method print
- self~getData
- if self~male = 1 then title = "Mr."
- else title = "Ms."
- if self~married = 1 then addition = " (married) "
- else addition = ""
- call infoDialog title self~name addition || "A"x || "City:" self~city || "A"x ||,
- "Profession:" self~profession
-
-::method validate
- if self~getControlData(21)~strip = "" then do
- call infoDialog "An unnamed employee is not accepted!"
- return .false /* dialog cannot be closed */
- end
- else do
- return .true /* dialog can be closed */
- end
Copied: main/trunk/samples/windows/oodialog/tutorial/employe4validate.rex (from rev 7739, main/trunk/samples/windows/oodialog/tutorial/employe4valid.rex)
===================================================================
--- main/trunk/samples/windows/oodialog/tutorial/employe4validate.rex (rev 0)
+++ main/trunk/samples/windows/oodialog/tutorial/employe4validate.rex 2012-04-07 19:54:55 UTC (rev 7740)
@@ -0,0 +1,83 @@
+/*----------------------------------------------------------------------------*/
+/* */
+/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
+/* Copyright (c) 2005-2012 Rexx Language Association. All rights reserved. */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the Common Public License v1.0 which accompanies this */
+/* distribution. A copy is also available at the following address: */
+/* http://www.oorexx.org/license.html */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the distribution. */
+/* */
+/* Neither the name of Rexx Language Association nor the names */
+/* of its contributors may be used to endorse or promote products */
+/* derived from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
+/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
+/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
+/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
+/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*----------------------------------------------------------------------------*/
+
+/**
+ * Name: employe4valid.rex
+ * Type: Open Object REXX Script
+ */
+
+dlg = .MyDialogClass~new("employe2.rc", 100)
+if dlg~initCode <> 0 then exit
+
+dlg~execute("SHOWTOP")
+
+::requires "ooDialog.cls"
+
+::class MyDialogClass subclass RcDialog
+::method initDialog
+ self~city = "New York"
+ self~male = 1
+ self~female = 0
+ self~addComboEntry(22, "Munich")
+ self~addComboEntry(22, "New York")
+ self~addComboEntry(22, "San Francisco")
+ self~addComboEntry(22, "Stuttgart")
+ self~addListEntry(23, "Business Manager")
+ self~addListEntry(23, "Software Developer")
+ self~addListEntry(23, "Broker")
+ self~addListEntry(23, "Police Man")
+ self~addListEntry(23, "Lawyer")
+ self~connectButtonEvent(10, "CLICKED", "Print") /* connect button 10 with a method */
+
+::method print
+ self~getData
+ if self~male = 1 then title = "Mr."
+ else title = "Ms."
+ if self~married = 1 then addition = " (married) "
+ else addition = ""
+ call infoDialog title self~name addition || "A"x || "City:" self~city || "A"x ||,
+ "Profession:" self~profession
+
+::method validate
+ if self~getControlData(21)~strip = "" then do
+ call infoDialog "An unnamed employee is not accepted!"
+ return .false /* dialog cannot be closed */
+ end
+ else do
+ return .true /* dialog can be closed */
+ end
Deleted: main/trunk/samples/windows/oodialog/tutorial/employe9menuRc.rex
===================================================================
--- main/trunk/samples/windows/oodialog/tutorial/employe9menuRc.rex 2012-04-07 19:41:12 UTC (rev 7739)
+++ main/trunk/samples/windows/oodialog/tutorial/employe9menuRc.rex 2012-04-07 19:54:55 UTC (rev 7740)
@@ -1,297 +0,0 @@
-/*----------------------------------------------------------------------------*/
-/* */
-/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
-/* Copyright (c) 2005-2012 Rexx Language Association. All rights reserved. */
-/* */
-/* This program and the accompanying materials are made available under */
-/* the terms of the Common Public License v1.0 which accompanies this */
-/* distribution. A copy is also available at the following address: */
-/* http://www.oorexx.org/license.html */
-/* */
-/* Redistribution and use in source and binary forms, with or */
-/* without modification, are permitted provided that the following */
-/* conditions are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* Redistributions in binary form must reproduce the above copyright */
-/* notice, this list of conditions and the following disclaimer in */
-/* the documentation and/or other materials provided with the distribution. */
-/* */
-/* Neither the name of Rexx Language Association nor the names */
-/* of its contributors may be used to endorse or promote products */
-/* derived from this software without specific prior written permission. */
-/* */
-/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
-/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
-/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
-/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
-/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
-/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
-/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
-/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/*----------------------------------------------------------------------------*/
-
-/**
- * Name: employe9menuRc.rex
- * Type: Open Object REXX Script
- *
- * Description: Adds a menu, obtained from the .rc script, to the Employees
- * application. Continues the refinement / enhancement of the
- * application.
- */
-
- .application~setDefaults('O', 'employe7.h', .false)
-
- dlg = .MyDialogClass~new("employe7.rc", IDD_EMPLOYEES7)
- if dlg~initCode <> 0 then return 99
- dlg~execute("SHOWTOP")
-
-return 0
-
-
-::requires "ooDialog.cls"
-
-::class 'MyDialogClass' subclass RcDialog
-
-::attribute employees
-::attribute empCount
-
-::method init
- expose menuBar
-
- forward class (super) continue
- if self~initCode <> 0 then return self~initCode
-
- self~employees = .array~new(10)
- self~empCount = 0
-
- self~connectButtonEvent(IDC_PB_PRINT, "CLICKED", "onPrint")
- self~connectButtonEvent(IDC_PB_ADD, "CLICKED", "onAdd")
- self~connectButtonEvent(IDC_PB_LIST, "CLICKED", "onList")
- self~connectButtonEvent(IDC_RB_ADD, "CLICKED", "onAdding")
- self~connectButtonEvent(IDC_RB_BROWSE, "CLICKED", "onBrowsing")
-
- self~connectEditEvent(IDC_EDIT_NAME, "CHANGE", onNameChange)
- self~connectUpDownEvent(IDC_UPD, "DELTAPOS", onEmpChange)
-
- menuBar = .ScriptMenuBar~new("employe7.rc", IDM_MENUBAR, 0)
- menuBar~connectCommandEvent(IDM_ADD, "onAdd", self)
- menuBar~connectCommandEvent(IDM_PRINT, "onPrint", self)
- menuBar~connectCommandEvent(IDM_LIST, "onList", self)
- menuBar~connectCommandEvent(IDM_ABOUT, "about", self)
-
- return self~initCode
-
-::method initDialog
- expose cbCity lbPosition menuBar
-
- cbCity = self~newComboBox(IDC_CB_CITY)
- cbCity~add("Munich")
- cbCity~add("New York")
- cbCity~add("San Francisco")
- cbCity~add("Stuttgart")
- cbCity~add("San Diego")
- cbCity~add("Tucson")
- cbCity~add("Houston")
- cbCity~add("Las Angles")
-
- lbPosition = self~newListBox(IDC_LB_POSITION)
- lbPosition~add("Business Manager")
- lbPosition~add("Engineering Manager")
- lbPosition~add("Software Developer")
- lbPosition~add("Software QA")
- lbPosition~add("Accountant")
- lbPosition~add("Security")
- lbPosition~add("Secretary")
- lbPosition~add("Recptionist")
- lbPosition~add("Lab Manager")
- lbPosition~add("Lawyer")
- lbPosition~add("CEO")
-
- menuBar~attachTo(self, 1)
-
- self~setControls
- self~defaultForm
-
-
-::method onPrint
- expose cbCity lbPosition rbMale chkMarried editName
-
- title = "Acme Software - Employee:"
-
- if rbMale~checked then msg = "Mr."
- else msg = "Ms."
- msg ||= editName~getText
-
- if chkMarried~checked then msg ||= " (married) "
- msg ||= "A"x || "City:" cbCity~selected || "A"x || "Profession:" lbPosition~selected
-
- j = MessageDialog(msg, self~hwnd, title, , INFORMATION)
-
-::method onAdd
- expose cbCity lbPosition rbMale chkMarried editName pbList upDown rbBrowse
-
- self~empCount += 1
- self~employees[self~empCount] = .directory~new
- self~employees[self~empCount]['NAME'] = editName~getText
- self~employees[self~empCount]['CITY'] = cbCity~selected
- self~employees[self~empCount]['POSITION'] = lbPosition~selected
-
- if rbMale~checked then sex = 1
- else sex = 2
-
- self~employees[self~empCount]['SEX'] = sex
- self~employees[self~empCount]['MARRIED'] = chkMarried~checked
-
- upDown~setRange(1, self~empCount)
- if self~empCount == 1 then do
- rbBrowse~enable
- upDown~setPosition(1)
- end
-
- self~defaultForm
-
-::method onNameChange
- expose menuBar editName rbAdd pbAdd pbPrint
-
- if rbAdd~checked then do
- if editName~getText~strip~length == 0 then do
- pbAdd~disable
- pbPrint~disable
- menuBar~disable(IDM_ADD)
- menuBar~disable(IDM_PRINT)
- end
- else do
- pbAdd~enable
- pbPrint~enable
- menuBar~enable(IDM_ADD)
- menuBar~enable(IDM_PRINT)
- end
- end
-
-::method onEmpChange
- use arg curPos, increment
-
- self~setEmpRecord(curPos + increment)
- return .UpDown~deltaPosReply
-
-::method onAdding
- self~defaultForm
-
-::method onBrowsing
- expose upDown pbAdd menuBar
-
- pbAdd~disable
- menuBar~disable(IDM_ADD)
- upDown~enable
- self~setEmpRecord(upDown~getPosition)
-
-::method setEmpRecord
- expose upDown editName cbCity lbPosition rbMale rbFemale chkMarried
- use strict arg emp
-
- if emp < 1 then return self~noRecord('bottom')
- else if emp > upDown~getRange~max then return self~noRecord('top')
-
- editName~setText(self~employees[emp]['NAME'])
-
- cbCity~select(self~employees[emp]['CITY'])
- lbPosition~select(self~employees[emp]['POSITION'])
-
- if self~employees[emp]['SEX'] = 1 then do
- rbMale~check
- rbFemale~uncheck
- end
- else do
- rbFemale~check
- rbMale~uncheck
- end
-
- if self~employees[emp]['MARRIED'] then chkMarried~check
- else chkMarried~uncheck
-
-
-::method onList
- lDlg = .EmployeeListClass~new("employe7.rc", IDD_EMPLOYEE_LIST)
- lDlg~parent = self
- lDlg~execute("SHOWTOP")
-
-
-::method fillList
- use strict arg list
- do id = 1 to self~empCount
- if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms."
- addstring = title self~employees[id]['NAME']
- addstring = addstring || "9"x || self~employees[id]['POSITION']
- addstring = addstring || "9"x || self~employees[id]['CITY']
- list~insert(id, addstring)
- end
-
-::method about
- call infoDialog "Sample to demonstrate ooDialog menus."
-
-::method setControls private
- expose rbMale rbFemale rbAdd rbBrowse chkMarried editName pbList pbAdd pbPrint upDown
-
- pbAdd = self~newPushButton(IDC_PB_ADD)
- pbList = self~newPushButton(IDC_PB_LIST)
- pbPrint = self~newPushButton(IDC_PB_PRINT)
- rbMale = self~newRadioButton(IDC_RB_MALE)
- rbFemale = self~newRadioButton(IDC_RB_FEMALE)
- rbAdd = self~newRadioButton(IDC_RB_ADD)
- rbBrowse = self~newRadioButton(IDC_RB_BROWSE)
- chkMarried = self~newCheckBox(IDC_CHK_MARRIED)
- editName = self~newEdit(IDC_EDIT_NAME)
- upDown = self~newUpDown(IDC_UPD)
-
-::method defaultForm private
- expose menuBar cbCity lbPosition rbMale rbFemale rbAdd rbBrowse chkMarried -
- editName pbAdd pbList pbPrint upDown
-
- editName~setText("")
- cbCity~select("New York")
- lbPosition~select("Software Developer")
-
- rbMale~check
- rbFemale~uncheck
- chkMarried~uncheck
-
- rbAdd~check
- pbAdd~disable
- pbPrint~disable
- menuBar~disable(IDM_ADD)
- menuBar~disable(IDM_PRINT)
- upDown~disable
-
- editName~assignFocus
-
- if self~empCount < 1 then do
- pbList~disable
- rbBrowse~disable
- upDown~setRange(0, 0)
- upDown~setPosition(0)
- end
- else do
- pbList~enable
- menuBar~enable(IDM_LIST)
- end
-
-::method noRecord private
- use strict arg direction
- return MessageDialog('At the' direction 'of the records', self~hwnd, -
- 'Employee Records')
-
-
-::class 'EmployeeListClass' subclass RcDialog
-
-::attribute parent
-
-::method initDialog
- lb = self~newListBox(IDC_LB_EMPLOYEES_LIST)
- self~parent~fillList(lb)
- lb~setTabulators(90, 190)
Added: main/trunk/samples/windows/oodialog/tutorial/employee11tab.h
===================================================================
--- main/trunk/samples/windows/oodialog/tutorial/employee11tab.h (rev 0)
+++ main/trunk/samples/windows/oodialog/tutorial/employee11tab.h 2012-04-07 19:54:55 UTC (rev 7740)
@@ -0,0 +1,35 @@
+#ifndef IDC_STATIC
+#define IDC_STATIC (-1)
+#endif
+
+#define IDD_EMPLOYEES_LIST 207
+#define IDD_EMPLOYEES_BROWSE 208
+#define IDD_EMPLOYEES_ADD 209
+#define IDD_EMPLOYEES_EDIT 210
+#define IDC_GB1 1000
+#define IDC_LV_EMPLOYEES 1001
+#define IDC_PB_PRINT_A 1001
+#define IDC_PB_PRINT_E 1002
+#define IDC_UPD 1002
+#define IDC_PB_PRINT_E1 1003
+#define IDC_EDIT_NAME_B 1005
+#define IDC_CB_CITY_B 1009
+#define IDC_LB_POSITION_B 1011
+#define IDC_RB_MALE_B 1012
+#define IDC_RB_FEMALE_B 1013
+#define IDC_CHK_MARRIED_B 1014
+#define IDC_CHK_FULLTIME_B 1015
+#define IDC_EDIT_NAME_A 1016
+#define IDC_CB_CITY_A 1017
+#define IDC_LB_POSITION_A 1018
+#define IDC_RB_MALE_A 1019
+#define IDC_RB_FEMALE_A 1020
+#define IDC_CHK_MARRIED_A 1021
+#define IDC_CHK_FULLTIME_A 1022
+#define IDC_EDIT_NAME_E 1023
+#define IDC_CB_CITY_E 1024
+#define IDC_LB_POSITION_E 1025
+#define IDC_RB_MALE_E 1026
+#define IDC_RB_FEMALE_E 1027
+#define IDC_CHK_MARRIED_E 1028
+#define IDC_CHK_FULLTIME_E 1029
Property changes on: main/trunk/samples/windows/oodialog/tutorial/employee11tab.h
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: main/trunk/samples/windows/oodialog/tutorial/employee11tab.rc (from rev 7739, main/trunk/samples/windows/oodialog/tutorial/employe10tab.rc)
===================================================================
--- main/trunk/samples/windows/oodialog/tutorial/employee11tab.rc (rev 0)
+++ main/trunk/samples/windows/oodialog/tutorial/employee11tab.rc 2012-04-07 19:54:55 UTC (rev 7740)
@@ -0,0 +1,83 @@
+#include <windows.h>
+#include <winuser.h>
+#include <commctrl.h>
+#include "employee11tab.h"
+
+
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDD_EMPLOYEES_ADD DIALOG 0, 0, 227, 160
+STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP
+CAPTION "Add Employees"
+FONT 10, "Tahoma"
+{
+ LTEXT "Person:", -1, 12, 20, 30, 8, SS_LEFT
+ EDITTEXT IDC_EDIT_NAME_A, 40, 20, 102, 12
+ LTEXT "City:", -1, 12, 37, 16, 8, SS_LEFT
+ COMBOBOX IDC_CB_CITY_A, 40, 37, 102, 56, WS_TABSTOP | CBS_DROPDOWNLIST
+ LTEXT "Position:", -1, 12, 58, 30, 8, SS_LEFT
+ LISTBOX IDC_LB_POSITION_A, 10, 68, 132, 82, WS_TABSTOP | WS_VSCROLL | LBS_SORT | LBS_NOTIFY
+ GROUPBOX "Statistics", IDC_GB1, 153, 20, 64, 80, WS_GROUP
+ AUTORADIOBUTTON "&Male", IDC_RB_MALE_A, 161, 31, 40, 12, WS_TABSTOP
+ AUTORADIOBUTTON "&Female", IDC_RB_FEMALE_A, 161, 46, 40, 12
+ AUTOCHECKBOX "Ma&rried", IDC_CHK_MARRIED_A, 161, 63, 40, 12, WS_GROUP
+ AUTOCHECKBOX "Full Time", IDC_CHK_FULLTIME_A, 161, 82, 40, 12, WS_GROUP
+ PUSHBUTTON "Print", IDC_PB_PRINT_A, 167, 136, 50, 14
+}
+
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDD_EMPLOYEES_BROWSE DIALOG 0, 0, 227, 160
+STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP
+CAPTION "Browse Employees"
+FONT 10, "Tahoma"
+{
+ LTEXT "Person:", -1, 12, 20, 30, 8, SS_LEFT
+ EDITTEXT IDC_EDIT_NAME_B, 40, 20, 102, 12, ES_READONLY
+ CONTROL "", IDC_UPD, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY, 132, 20, 10, 12
+ LTEXT "City:", -1, 12, 37, 16, 8, SS_LEFT
+ COMBOBOX IDC_CB_CITY_B, 40, 37, 102, 56, WS_TABSTOP | WS_DISABLED | CBS_DROPDOWNLIST
+ LTEXT "Position:", -1, 12, 58, 30, 8, SS_LEFT
+ LISTBOX IDC_LB_POSITION_B, 10, 68, 132, 82, WS_TABSTOP | WS_VSCROLL | WS_DISABLED | LBS_SORT | LBS_NOTIFY
+ GROUPBOX "Statistics", IDC_GB1, 153, 20, 64, 80, WS_GROUP
+ AUTORADIOBUTTON "&Male", IDC_RB_MALE_B, 161, 31, 40, 12, WS_TABSTOP | WS_DISABLED
+ AUTORADIOBUTTON "&Female", IDC_RB_FEMALE_B, 161, 46, 40, 12, WS_DISABLED
+ AUTOCHECKBOX "Ma&rried", IDC_CHK_MARRIED_B, 161, 63, 40, 12, WS_GROUP | WS_DISABLED
+ AUTOCHECKBOX "Full Time", IDC_CHK_FULLTIME_B, 161, 82, 40, 12, WS_GROUP | WS_DISABLED
+ PUSHBUTTON "Print", IDC_PB_PRINT_E1, 167, 136, 50, 14
+}
+
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDD_EMPLOYEES_EDIT DIALOG 0, 0, 227, 160
+STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP
+CAPTION "Edit Employees"
+FONT 10, "Tahoma"
+{
+ LTEXT "Person:", -1, 12, 20, 30, 8, SS_LEFT
+ EDITTEXT IDC_EDIT_NAME_E, 40, 20, 102, 12
+ LTEXT "City:", -1, 12, 37, 16, 8, SS_LEFT
+ COMBOBOX IDC_CB_CITY_E, 40, 37, 102, 56, WS_TABSTOP | CBS_DROPDOWNLIST
+ LTEXT "Position:", -1, 12, 58, 30, 8, SS_LEFT
+ LISTBOX IDC_LB_POSITION_E, 10, 68, 132, 82, WS_TABSTOP | WS_VSCROLL | LBS_SORT | LBS_NOTIFY
+ GROUPBOX "Statistics", IDC_GB1, 153, 20, 64, 80, WS_GROUP
+ AUTORADIOBUTTON "&Male", IDC_RB_MALE_E, 161, 31, 40, 12, WS_TABSTOP
+ AUTORADIOBUTTON "&Female", IDC_RB_FEMALE_E, 161, 46, 40, 12
+ AUTOCHECKBOX "Ma&rried", IDC_CHK_MARRIED_E, 161, 63, 40, 12, WS_GROUP
+ AUTOCHECKBOX "Full Time", IDC_CHK_FULLTIME_E, 161, 82, 40, 12, WS_GROUP
+ PUSHBUTTON "Print", IDC_PB_PRINT_E, 167, 136, 50, 14
+}
+
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDD_EMPLOYEES_LIST DIALOG 0, 0, 227, 160
+STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP
+CAPTION "List Employees"
+FONT 10, "Tahoma"
+{
+ CONTROL "", IDC_LV_EMPLOYEES, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT, 10, 10, 207, 140
+}
Copied: main/trunk/samples/windows/oodialog/tutorial/employee11tab.rex (from rev 7739, main/trunk/samples/windows/oodialog/tutorial/employe10tab.rex)
===================================================================
--- main/trunk/samples/windows/oodialog/tutorial/employee11tab.rex (rev 0)
+++ main/trunk/samples/windows/oodialog/tutorial/employee11tab.rex 2012-04-07 19:54:55 UTC (rev 7740)
@@ -0,0 +1,745 @@
+/*----------------------------------------------------------------------------*/
+/* */
+/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
+/* Copyright (c) 2005-2012 Rexx Language Association. All rights reserved. */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the Common Public License v1.0 which accompanies this */
+/* distribution. A copy is also available at the following address: */
+/* http://www.oorexx.org/license.html */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the following */
+/* conditions are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the distribution. */
+/* */
+/* Neither the name of Rexx Language Association nor the names */
+/* of its contributors may be used to endorse or promote products */
+/* derived from this software without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
+/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
+/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
+/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
+/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
+/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*----------------------------------------------------------------------------*/
+
+/**
+ * Name: employee11tab.rex
+ * Type: Open Object REXX Script
+ *
+ * Description: Example to demonstrate the property sheet dialog class.
+ */
+
+ -- Note to self, we do not use data attributes in this app, need explanation.
+ .application~setDefaults("O", "employee11tab.h", .false)
+
+ -- Create the dialog pages.
+ p1 = .EmployeeAdd~new("employee11tab.rc", IDD_EMPLOYEES_ADD)
+ p2 = .EmployeeEdit~new("employee11tab.rc", IDD_EMPLOYEES_EDIT)
+ p3 = .EmployeeBrowse~new("employee11tab.rc", IDD_EMPLOYEES_BROWSE)
+ p4 = .EmployeeList~new("employee11tab.rc", IDD_EMPLOYEES_LIST)
+
+ pages = .array~of(p1, p2, p3, p4)
+ dlg = .AcmeEmployeesDlg~new(pages, "", "Acme Software - Employee Manager Version 10.00.0")
+
+ dlg~execute
+
+ return 0
+
+::requires "ooDialog.cls"
+
+
+::class 'AcmeEmployeesDlg' subclass PropertySheetDialog
+
+::attribute employees
+::attribute empCount
+::attribute empIndex
+
+::method init
+ forward class (super) continue
+ --say 'In' self 'init()'
+
+ -- need to get employees from database
+ self~employees = .array~new(10)
+ self~empCount = 0
+ self~empIndex = 0
+
+
+ --say 'Pages:'
+ do d over self~pages
+ --say ' ' d
+ d~configure(self~employees, self~empCount, self~empIndex)
+ end
+
+::method initDialog
+
+ say 'In' self 'initDialog()'
+
+::class 'EmployeeAdd' subclass RcPSPDialog
+
+::attribute employees
+::attribute empCount
+::attribute empIndex
+
+::method configure
+ use arg employees, count
+
+ self~employees = employess
+ self~empCount = count
+
+ self~connectEditEvent(IDC_EDIT_NAME_A, "CHANGE", onNameChange)
+ say 'In' self 'configure() propSheet?' self~propSheet
+
+::method initDialog
+ expose cbCity lbPosition
+
+ say 'In' self 'init() self~propSheet?' self~propSheet
+ self~setControls
+
+ cbCity~add("Munich")
+ cbCity~add("New York")
+ cbCity~add("San Francisco")
+ cbCity~add("Stuttgart")
+ cbCity~add("San Diego")
+ cbCity~add("Tucson")
+ cbCity~add("Houston")
+ cbCity~add("Las Angles")
+
+ lbPosition~add("Business Manager")
+ lbPosition~add("Engineering Manager")
+ lbPosition~add("Software Developer")
+ lbPosition~add("Software QA")
+ lbPosition~add("Accountant")
+ lbPosition~add("Security")
+ lbPosition~add("Secretary")
+ lbPosition~add("Recptionist")
+ lbPosition~add("Lab Manager")
+ lbPosition~add("Lawyer")
+ lbPosition~add("CEO")
+
+ self~defaultForm
+
+
+::method setActive unguarded
+
+ self~defaultForm
+ return 0
+
+::method killActive unguarded
+ use arg psDlg
+
+ say 'leaving will abandon changes'
+ return .true
+
+::method onPrint
+ expose cbCity lbPosition rbMale chkMarried editName
+
+ title = "Acme Software - Employee:"
+
+ if rbMale~checked then msg = "Mr."
+ else msg = "Ms."
+ msg ||= editName~getText
+
+ if chkMarried~checked then msg ||= " (married) "
+ msg ||= "A"x || "City:" cbCity~selected || "A"x || "Profession:" lbPosition~selected
+
+ j = MessageDialog(msg, self~hwnd, title, , INFORMATION)
+
+::method onAdd
+ expose cbCity lbPosition rbMale chkMarried editName pbList upDown rbBrowse
+
+ self~empCount += 1
+ self~employees[self~empCount] = .directory~new
+ self~employees[self~empCount]['NAME'] = editName~getText
+ self~employees[self~empCount]['CITY'] = cbCity~selected
+ self~employees[self~empCount]['POSITION'] = lbPosition~selected
+
+ if rbMale~checked then sex = 1
+ else sex = 2
+
+ self~employees[self~empCount]['SEX'] = sex
+ self~employees[self~empCount]['MARRIED'] = chkMarried~checked
+
+ upDown~setRange(1, self~empCount)
+ if self~empCount == 1 then do
+ rbBrowse~enable
+ upDown~setPosition(1)
+ end
+
+ self~defaultForm
+
+::method onNameChange
+ expose editName
+ say 'NEED TO DO SOMETHING HERE'
+ /*
+ if rbAdd~checked then do
+ if editName~getText~strip~length == 0 then do
+ pbAdd~disable
+ pbPrint~disable
+ menuBar~disable(IDM_ADD)
+ menuBar~disable(IDM_PRINT)
+ end
+ else do
+ pbAdd~enable
+ pbPrint~enable
+ menuBar~enable(IDM_ADD)
+ menuBar~enable(IDM_PRINT)
+ end
+ end
+ */
+
+::method onEmpChange
+ use arg curPos, increment
+
+ self~setEmpRecord(curPos + increment)
+ return .UpDown~deltaPosReply
+
+::method onAdding
+ self~defaultForm
+
+::method onBrowsing
+ expose upDown pbAdd menuBar
+
+ pbAdd~disable
+ menuBar~disable(IDM_ADD)
+ upDown~enable
+ self~setEmpRecord(upDown~getPosition)
+
+::method setEmpRecord
+ expose upDown editName cbCity lbPosition rbMale rbFemale chkMarried
+ use strict arg emp
+
+ if emp < 1 then return self~noRecord('bottom')
+ else if emp > upDown~getRange~max then return self~noRecord('top')
+
+ editName~setText(self~employees[emp]['NAME'])
+
+ cbCity~select(self~employees[emp]['CITY'])
+ lbPosition~select(self~employees[emp]['POSITION'])
+
+ if self~employees[emp]['SEX'] = 1 then do
+ rbMale~check
+ rbFemale~uncheck
+ end
+ else do
+ rbFemale~check
+ rbMale~uncheck
+ end
+
+ if self~employees[emp]['MARRIED'] then chkMarried~check
+ else chkMarried~uncheck
+
+
+::method onList
+ lDlg = .EmployeeListClass~new("employe7.rc", IDD_EMPLOYEE_LIST)
+ lDlg~parent = self
+ lDlg~execute("SHOWTOP")
+
+
+::method fillList
+ use strict arg list
+ do id = 1 to self~empCount
+ if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms."
+ addstring = title self~employees[id]['NAME']
+ addstring = addstring || "9"x || self~employees[id]['POSITION']
+ addstring = addstring || "9"x || self~employees[id]['CITY']
+ list~insert(id, addstring)
+ end
+
+::method about
+ call infoDialog "Sample to demonstrate ooDialog menus."
+
+::method setControls private
+ expose cbCity lbPosition rbMale rbFemale chkMarried chkFullTime editName
+
+ cbCity = self~newComboBox(IDC_CB_CITY_A)
+ lbPosition = self~newListBox(IDC_LB_POSITION_A)
+ rbMale = self~newRadioButton(IDC_RB_MALE_A)
+ rbFemale = self~newRadioButton(IDC_RB_FEMALE_A)
+ chkMarried = self~newCheckBox(IDC_CHK_MARRIED_A)
+ chkFullTime = self~newCheckBox(IDC_CHK_FULLTIME_A)
+ editName = self~newEdit(IDC_EDIT_NAME_A)
+
+::method defaultForm private
+ expose cbCity lbPosition rbMale rbFemale chkMarried chkFullTime editName
+ say 'In defaultForm()'
+ editName~setText("")
+ cbCity~select("New York")
+ lbPosition~select("Software Developer")
+
+ rbMale~check
+ rbFemale~uncheck
+ chkMarried~uncheck
+ chkFullTime~check
+
+ editName~assignFocus
+
+ /*
+ if self~empCount < 1 then do
+ pbList~disable
+ rbBrowse~disable
+ upDown~setRange(0, 0)
+ upDown~setPosition(0)
+ end
+ else do
+ pbList~enable
+ menuBar~enable(IDM_LIST)
+ end
+ */
+
+::method noRecord private
+ use strict arg direction
+ return MessageDialog('At the' direction 'of the records', self~hwnd, -
+ 'Employee Records')
+
+
+
+::class 'EmployeeEdit' subclass RcPSPDialog
+
+::attribute employees
+::attribute empCount
+::attribute empIndex
+
+::method configure
+ use arg employees, count
+
+ self~employees = employess
+ self~empCount = count
+
+ self~connectEditEvent(IDC_EDIT_NAME_A, "CHANGE", onNameChange)
+ say 'In' self 'configure() propSheet?' self~propSheet
+
+::method initDialog
+ expose cbCity lbPosition
+
+ self~setControls
+
+ cbCity~add("Munich")
+ cbCity~add("New York")
+ cbCity~add("San Francisco")
+ cbCity~add("Stuttgart")
+ cbCity~add("San Diego")
+ cbCity~add("Tucson")
+ cbCity~add("Houston")
+ cbCity~add("Las Angles")
+
+ lbPosition~add("Business Manager")
+ lbPosition~add("Engineering Manager")
+ lbPosition~add("Software Developer")
+ lbPosition~add("Software QA")
+ lbPosition~add("Accountant")
+ lbPosition~add("Security")
+ lbPosition~add("Secretary")
+ lbPosition~add("Recptionist")
+ lbPosition~add("Lab Manager")
+ lbPosition~add("Lawyer")
+ lbPosition~add("CEO")
+
+
+
+::method onPrint
+ expose cbCity lbPosition rbMale chkMarried editName
+
+ title = "Acme Software - Employee:"
+
+ if rbMale~checked then msg = "Mr."
+ else msg = "Ms."
+ msg ||= editName~getText
+
+ if chkMarried~checked then msg ||= " (married) "
+ msg ||= "A"x || "City:" cbCity~selected || "A"x || "Profession:" lbPosition~selected
+
+ j = MessageDialog(msg, self~hwnd, title, , INFORMATION)
+
+::method onAdd
+ expose cbCity lbPosition rbMale chkMarried editName pbList upDown rbBrowse
+
+ self~empCount += 1
+ self~employees[self~empCount] = .directory~new
+ self~employees[self~empCount]['NAME'] = editName~getText
+ self~employees[self~empCount]['CITY'] = cbCity~selected
+ self~employees[self~empCount]['POSITION'] = lbPosition~selected
+
+ if rbMale~checked then sex = 1
+ else sex = 2
+
+ self~employees[self~empCount]['SEX'] = sex
+ self~employees[self~empCount]['MARRIED'] = chkMarried~checked
+
+ upDown~setRange(1, self~empCount)
+ if self~empCount == 1 then do
+ rbBrowse~enable
+ upDown~setPosition(1)
+ end
+
+ self~defaultForm
+
+::method onNameChange
+ expose menuBar editName rbAdd pbAdd pbPrint
+
+ if rbAdd~checked then do
+ if editName~getText~strip~length == 0 then do
+ pbAdd~disable
+ pbPrint~disable
+ menuBar~disable(IDM_ADD)
+ menuBar~disable(IDM_PRINT)
+ end
+ else do
+ pbAdd~enable
+ pbPrint~enable
+ menuBar~enable(IDM_ADD)
+ menuBar~enable(IDM_PRINT)
+ end
+ end
+
+::method onEmpChange
+ use arg curPos, increment
+
+ self~setEmpRecord(curPos + increment)
+ return .UpDown~deltaPosReply
+
+::method onAdding
+ self~defaultForm
+
+::method onBrowsing
+ expose upDown pbAdd menuBar
+
+ pbAdd~disable
+ menuBar~disable(IDM_ADD)
+ upDown~enable
+ self~setEmpRecord(upDown~getPosition)
+
+::method setEmpRecord
+ expose upDown editName cbCity lbPosition rbMale rbFemale chkMarried
+ use strict arg emp
+
+ if emp < 1 then return self~noRecord('bottom')
+ else if emp > upDown~getRange~max then return self~noRecord('top')
+
+ editName~setText(self~employees[emp]['NAME'])
+
+ cbCity~select(self~employees[emp]['CITY'])
+ lbPosition~select(self~employees[emp]['POSITION'])
+
+ if self~employees[emp]['SEX'] = 1 then do
+ rbMale~check
+ rbFemale~uncheck
+ end
+ else do
+ rbFemale~check
+ rbMale~uncheck
+ end
+
+ if self~employees[emp]['MARRIED'] then chkMarried~check
+ else chkMarried~uncheck
+
+
+::method fillList
+ use strict arg list
+ do id = 1 to self~empCount
+ if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms."
+ addstring = title self~employees[id]['NAME']
+ addstring = addstring || "9"x || self~employees[id]['POSITION']
+ addstring = addstring || "9"x || self~employees[id]['CITY']
+ list~insert(id, addstring)
+ end
+
+::method about
+ call infoDialog "Sample to demonstrate ooDialog menus."
+
+::method setControls private
+ expose cbCity lbPosition rbMale rbFemale chkMarried chkFullTime editName
+
+ cbCity = self~newComboBox(IDC_CB_CITY_E)
+ lbPosition = self~newListBox(IDC_LB_POSITION_E)
+ rbMale = self~newRadioButton(IDC_RB_MALE_E)
+ rbFemale = self~newRadioButton(IDC_RB_FEMALE_E)
+ chkMarried = self~newCheckBox(IDC_CHK_MARRIED_E)
+ editName = self~newEdit(IDC_EDIT_NAME_E)
+
+::method defaultForm private
+ expose menuBar cbCity lbPosition rbMale rbFemale rbAdd rbBrowse chkMarried -
+ editName pbAdd pbList pbPrint upDown
+
+ editName~setText("")
+ cbCity~select("New York")
+ lbPosition~select("Software Developer")
+
+ rbMale~check
+ rbFemale~uncheck
+ chkMarried~uncheck
+
+ rbAdd~check
+ pbAdd~disable
+ pbPrint~disable
+ menuBar~disable(IDM_ADD)
+ menuBar~disable(IDM_PRINT)
+ upDown~disable
+
+ editName~assignFocus
+
+ if self~empCount < 1 then do
+ pbList~disable
+ rbBrowse~disable
+ upDown~setRange(0, 0)
+ upDown~setPosition(0)
+ end
+ else do
+ pbList~enable
+ menuBar~enable(IDM_LIST)
+ end
+
+::method noRecord private
+ use strict arg direction
+ return MessageDialog('At the' direction 'of the records', self~hwnd, -
+ 'Employee Records')
+
+
+
+::class 'EmployeeBrowse' subclass RcPSPDialog
+
+::attribute employees
+::attribute empCount
+::attribute empIndex
+
+::method configure
+ use arg employees, count, empIndex
+
+ self~employees = employess
+ self~empCount = count
+ self~empIndex = empIndex
+
+ say 'In' self 'configure() propSheet?' self~propSheet
+
+::method initDialog
+ expose cbCity lbPosition
+
+ cbCity = self~newComboBox(IDC_CB_CITY_B)
+ cbCity~add("Munich")
+ cbCity~add("New York")
+ cbCity~add("San Francisco")
+ cbCity~add("Stuttgart")
+ cbCity~add("San Diego")
+ cbCity~add("Tucson")
+ cbCity~add("Houston")
+ cbCity~add("Las Angles")
+
+ lbPosition = self~newListBox(IDC_LB_POSITION_B)
+ lbPosition~add("Business Manager")
+ lbPosition~add("Engineering Manager")
+ lbPosition~add("Software Developer")
+ lbPosition~add("Software QA")
+ lbPosition~add("Accountant")
+ lbPosition~add("Security")
+ lbPosition~add("Secretary")
+ lbPosition~add("Recptionist")
+ lbPosition~add("Lab Manager")
+ lbPosition~add("Lawyer")
+ lbPosition~add("CEO")
+
+ self~setControls
+
+
+::method onPrint
+ expose cbCity lbPosition rbMale chkMarried editName
+
+ title = "Acme Software - Employee:"
+
+ if rbMale~checked then msg = "Mr."
+ else msg = "Ms."
+ msg ||= editName~getText
+
+ if chkMarried~checked then msg ||= " (married) "
+ msg ||= "A"x || "City:" cbCity~selected || "A"x || "Profession:" lbPosition~selected
+
+ j = MessageDialog(msg, self~hwnd, title, , INFORMATION)
+
+::method onAdd
+ expose cbCity lbPosition rbMale chkMarried editName pbList upDown rbBrowse
+
+ self~empCount += 1
+ self~employees[self~empCount] = .directory~new
+ self~employees[self~empCount]['NAME'] = editName~getText
+ self~employees[self~empCount]['CITY'] = cbCity~selected
+ self~employees[self~empCount]['POSITION'] = lbPosition~selected
+
+ if rbMale~checked then sex = 1
+ else sex = 2
+
+ self~employees[self~empCount]['SEX'] = sex
+ self~employees[self~empCount]['MARRIED'] = chkMarried~checked
+
+ upDown~setRange(1, self~empCount)
+ if self~empCount == 1 then do
+ rbBrowse~enable
+ upDown~setPosition(1)
+ end
+
+ self~defaultForm
+
+::method onNameChange
+ expose menuBar editName rbAdd pbAdd pbPrint
+
+ if rbAdd~checked then do
+ if editName~getText~strip~length == 0 then do
+ pbAdd~disable
+ pbPrint~disable
+ menuBar~disable(IDM_ADD)
+ menuBar~disable(IDM_PRINT)
+ end
+ else do
+ pbAdd~enable
+ pbPrint~enable
+ menuBar~enable(IDM_ADD)
+ menuBar~enable(IDM_PRINT)
+ end
+ end
+
+::method onEmpChange
+ use arg curPos, increment
+
+ self~setEmpRecord(curPos + increment)
+ return .UpDown~deltaPosReply
+
+::method onAdding
+ self~defaultForm
+
+::method onBrowsing
+ expose upDown pbAdd menuBar
+
+ pbAdd~disable
+ menuBar~disable(IDM_ADD)
+ upDown~enable
+ self~setEmpRecord(upDown~getPosition)
+
+::method setEmpRecord
+ expose upDown editName cbCity lbPosition rbMale rbFemale chkMarried
+ use strict arg emp
+
+ if emp < 1 then return self~noRecord('bottom')
+ else if emp > upDown~getRange~max then return self~noRecord('top')
+
+ editName~setText(self~employees[emp]['NAME'])
+
+ cbCity~select(self~employees[emp]['CITY'])
+ lbPosition~select(self~employees[emp]['POSITION'])
+
+ if self~employees[emp]['SEX'] = 1 then do
+ rbMale~check
+ rbFemale~uncheck
+ end
+ else do
+ rbFemale~check
+ rbMale~uncheck
+ end
+
+ if self~employees[emp]['MARRIED'] then chkMarried~check
+ else chkMarried~uncheck
+
+
+::method onList
+ lDlg = .EmployeeListClass~new("employe7.rc", IDD_EMPLOYEE_LIST)
+ lDlg~parent = self
+ lDlg~execute("SHOWTOP")
+
+
+::method fillList
+ use strict arg list
+ do id = 1 to self~empCount
+ if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms."
+ addstring = title self~employees[id]['NAME']
+ addstring = addstring || "9"x || self~employees[id]['POSITION']
+ addstring = addstring || "9"x || self~employees[id]['CITY']
+ list~insert(id, addstring)
+ end
+
+::method setControls private
+ expose cbCity lbPosition rbMale rbFemale chkMarried chkFullTime editName
+
+ cbCity = self~newComboBox(IDC_CB_CITY_B)
+ lbPosition = self~newListBox(IDC_LB_POSITION_B)
+ rbMale = self~newRadioButton(IDC_RB_MALE_B)
+ rbFemale = self~newRadioButton(IDC_RB_FEMALE_B)
+ chkMarried = self~newCheckBox(IDC_CHK_MARRIED_B)
+ editName = self~newEdit(IDC_EDIT_NAME_B)
+
+::method defaultForm private
+ expose menuBar cbCity lbPosition rbMale rbFemale rbAdd rbBrowse chkMarried -
+ editName pbAdd pbList pbPrint upDown
+
+ editName~setText("")
+ cbCity~select("New York")
+ lbPosition~select("Software Developer")
+
+ rbMale~check
+ rbFemale~uncheck
+ chkMarried~uncheck
+
+ rbAdd~check
+ pbAdd~disable
+ pbPrint~disable
+ menuBar~disable(IDM_ADD)
+ menuBar~disable(IDM_PRINT)
+ upDown~disable
+
+ editName~assignFocus
+
+ if self~empCount < 1 then do
+ pbList~disable
+ rbBrowse~disable
+ upDown~setRange(0, 0)
+ upDown~setPosition(0)
+ end
+ else do
+ pbList~enable
+ menuBar~enable(IDM_LIST)
+ end
+
+::method noRecord private
+ use strict arg direction
+ return MessageDialog('At the' direction 'of the records', self~hwnd, -
+ 'Employee Records')
+
+
+
+::class 'EmployeeList' subclass RcPSPDialog
+
+::attribute employees
+::attribute empCount
+::attribute empIndex
+
+::method configure
+ use arg employees, count
+
+ self~employees = employess
+ self~empCount = count
+
+ say 'In' self 'configure() propSheet?' self~propSheet
+
+::method initDialog
+ say 'In' self 'initDialog() need to fill listview'
+
+::method fillList
+ use strict arg list
+
+ do id = 1 to self~empCount
+ if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms."
+ addstring = title self~employees[id]['NAME']
+ addstring = addstring || "9"x || self~employees[id]['POSITION']
+ addstring = addstring || "9"x || self~employees[id]['CITY']
+ list~insert(id, addstring)
+ end
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|