From: <mie...@us...> - 2013-01-21 00:51:53
|
Revision: 8871 http://sourceforge.net/p/oorexx/code-0/8871 Author: miesfeld Date: 2013-01-21 00:51:49 +0000 (Mon, 21 Jan 2013) Log Message: ----------- Feature Requests: #249 Add support for generalized resizable dialogs See ticket [Feature-requests:#249] Modified Paths: -------------- ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/TabDemo.rex ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.h ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.rc Modified: ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/TabDemo.rex =================================================================== --- ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/TabDemo.rex 2013-01-20 22:27:11 UTC (rev 8870) +++ ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/TabDemo.rex 2013-01-21 00:51:49 UTC (rev 8871) @@ -52,19 +52,12 @@ * example, except it is resizable. */ + -- A directory manager saves the current directory and can later go back to + -- that directory. The class itself is located in DirectoryManaager.cls + mgr = .DirectoryManager~new() + .application~setDefaults("O", "rc\PropertySheetDemo.h", .false) - -- To run correctly, this program needs to be able to find its support files. - -- But, we allow starting the program from anywhere. To do this we: - -- get the directory we are executing from, switch to the directory this - -- program is installed in, and then switch back to the directory we started - -- from when we quit. - - curdir = directory(); -- Directory we started from. - parse source . . me - mydir = me~left(me~lastpos('\') - 1) -- Directory we are installed in. - mydir = directory(mydir) -- CD to the install direcotry. - -- The original version of this example would take a longish period of time to -- appear on the screen. Too much was being done in the initDialog() method -- of the .NewControlsDialog. To improve the time between starting the @@ -110,11 +103,11 @@ -- Show and run the dialog. dlg~execute('SHOWTOP', IDI_DLG_OODIALOG) - -- Switch back to the intial directory and quit. - ret = directory(curdir) + mgr~goBack return 0 ::requires "ooDialog.cls" +::requires "DirectoryManager.cls" ::class 'NewControlsDialog' subclass ResDialog inherit ResizingAdmin @@ -122,12 +115,78 @@ ::method defineSizing - dlgIDs = .array~of(IDD_LISTVIEW_DLG, IDD_TREEVIEW_DLG, IDD_PROGRESSBAR_DLG, - - IDD_TRACKBAR_DLG, IDD_TAB_DLG) - self~pagedTab(IDC_TAB, dlgIDs) + -- In order for the ResizingAdmin to properly size ControlDialog dialogs + -- used as pages in a tab control, it must be informed of the dialogs and + -- what tab control they are in. We do that by creating an array of their + -- IDs and pass the tab control's resource ID and the array to the + -- pagedTab() method. + -- + -- Note that the dialog IDs must be the dlgID attribute of the dialogs. In + -- this case the resource ID of the dialog has the same value as the dlgID + -- attribute, but this is not always the case. Please read the doc tor the + -- dlgID attribute in the ooDialog reference manual to understand this. - return 0 + dlgIDs = .array~of(IDD_LISTVIEW_DLG, IDD_TREEVIEW_DLG, IDD_PROGRESSBAR_DLG, - + IDD_TRACKBAR_DLG, IDD_TAB_DLG) + self~pagedTab(IDC_TAB, dlgIDs) + -- Now, we have 5 controls in this the main dialog. The tab control and 4 + -- push buttons. We define the sizing for all edges of the tab control at + -- one time. We want the tab control edges to remain the same distance + -- from each corresponding edge of the dialog. So we use a stationary pin + -- type. The pin to window is the dialog, which is the default, so we do + -- not need to specify the third index in the array. + self~controlSizing(IDC_TAB, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'TOP'), - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM') - + ) + + -- For the 4 push buttons, we want them to remain fixed in size, with the + -- Previous and Next buttons pinned to the bottom left of the dialog and the + -- Ok and Cancel buttons pinned to the right bottom of the dialog. + -- + -- There is probably some clever use of the default sizing that could reduce + -- the number of lines of code here, but it is sometimes better to just + -- spell everything out in code so that it is obvious what is happening. + + self~controlSizing(IDC_PB_PREVIOUS, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- Pin the left of the Next button to the right of the Previous button + self~controlSizing(IDC_PB_NEXT, - + .array~of('STATIONARY', 'RIGHT', IDC_PB_PREVIOUS), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- Now we just do a sort of 'mirror-image' of what we just did for the Ok + -- and Cancel buttons. + + self~controlSizing(IDCANCEL, - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- Pin the right of the Ok, button to the left of the Cancel button + self~controlSizing(IDOK, - + .array~of('STATIONARY', 'LEFT', IDCANCEL), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- We must return 0 from this method to continue. + return 0 + /** prep() * * This method is invoked before the dialog is executed. It does some initial @@ -349,6 +408,25 @@ ::class 'ListViewDlg' subclass ResControlDialog inherit ResizingAdmin +::method defineSizing + + -- The only control in this dialog is the list-view. We define its sizing + -- so that each edge of the list-view maintains the same distance to its + -- corresponding edeg of the dialog: + self~controlSizing(IDC_LV_MAIN, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'TOP'), - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM') - + ) + + + -- A value must be returned from the defineSizing() method. O allows the + -- dialog to continue, any other failure is a failure and the dialog will be + -- ended. + return 0 + + ::method initDialog expose lv imageList listData @@ -560,6 +638,12 @@ self~noMinSize + self~useDefaultSizing(IDC_PBAR_PROCESSA) + self~useDefaultSizing(IDC_PBAR_PROCESSB) + self~useDefaultSizing(IDC_PBAR_PROCESSC) + self~useDefaultSizing(IDC_PBAR_PROCESSD) + self~useDefaultSizing(IDC_PBAR_PROCESSE) + return 0 Modified: ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.h =================================================================== --- ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.h 2013-01-20 22:27:11 UTC (rev 8870) +++ ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.h 2013-01-21 00:51:49 UTC (rev 8871) @@ -76,3 +76,8 @@ #define IDC_ST_PERCENTE 1125 #define IDC_ST_FRAME_LEFT 1126 #define IDC_ST_FRAME_RIGHT 1127 +#define IDC_ST_PROCESSA 1128 +#define IDC_ST_PROCESSB 1129 +#define IDC_ST_PROCESSC 1130 +#define IDC_ST_PROCESSD 1131 +#define IDC_ST_PROCESSE 1132 Modified: ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.rc =================================================================== --- ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.rc 2013-01-20 22:27:11 UTC (rev 8870) +++ ooDialog/trunk/examples/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.rc 2013-01-21 00:51:49 UTC (rev 8871) @@ -40,10 +40,19 @@ #include <commctrl.h> #include "PropertySheetDemo.h" +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_LISTVIEW_DLG DIALOG 6, 15, 300, 250 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP +FONT 9, "Arial" +{ + CONTROL "ListView", IDC_LV_MAIN, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_REPORT, 7, 7, 286, 236 +} + + LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_NEWCONTROLS_DLG DIALOG 0, 0, 325, 300 -STYLE DS_MODALFRAME | DS_SETFONT | DS_CENTER | WS_CAPTION | WS_POPUP | WS_SYSMENU | WS_VISIBLE +STYLE DS_CENTER | DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU CAPTION "Example using ControlDialog objects" FONT 9, "Arial" { @@ -57,57 +66,43 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDD_LISTVIEW_DLG DIALOG 6, 15, 300, 250 -STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP -CAPTION "List View Control" -FONT 9, "Arial" -{ - CONTROL "ListView", IDC_LV_MAIN, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_REPORT, 7, 7, 286, 236 -} - - - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_PROGRESSBAR_DLG DIALOG 6, 15, 300, 250 -STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP -CAPTION "Progress Bar Control" +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP FONT 9, "Arial" { - CONTROL "Progress", IDC_PBAR_PROCESSA, PROGRESS_CLASS, PBS_VERTICAL, 37, 27, 13, 199 - CONTROL "Progress", IDC_PBAR_PROCESSB, PROGRESS_CLASS, PBS_VERTICAL, 86, 27, 13, 199 - CONTROL "Progress", IDC_PBAR_PROCESSC, PROGRESS_CLASS, PBS_VERTICAL, 135, 27, 13, 199 - CONTROL "Progress", IDC_PBAR_PROCESSD, PROGRESS_CLASS, WS_BORDER | PBS_SMOOTH | PBS_VERTICAL, 182, 27, 13, 199 - CONTROL "Progress", IDC_PBAR_PROCESSE, PROGRESS_CLASS, WS_BORDER | PBS_SMOOTH | PBS_VERTICAL, 236, 27, 13, 199 - LTEXT "100%", IDC_ST_PERCENTA, 34, 229, 21, 8, SS_LEFT - LTEXT "100%", IDC_ST_PERCENTB, 83, 229, 21, 8, SS_LEFT - LTEXT "100%", IDC_ST_PERCENTC, 132, 229, 21, 8, SS_LEFT - LTEXT "100%", IDC_ST_PERCENTD, 180, 229, 21, 8, SS_LEFT - LTEXT "100%", IDC_ST_PERCENTE, 234, 229, 21, 8, SS_LEFT - LTEXT "Process A", -1, 25, 12, 36, 8, SS_LEFT - LTEXT "Process B", -1, 74, 12, 36, 8, SS_LEFT - LTEXT "Process C", -1, 123, 12, 36, 8, SS_LEFT - LTEXT "Process D", -1, 170, 12, 36, 8, SS_LEFT - LTEXT "Process E", -1, 224, 12, 36, 8, SS_LEFT + CTEXT "Process A", IDC_ST_PROCESSA, 26, 12, 35, 8, SS_LEFT + CONTROL "Progress", IDC_PBAR_PROCESSA, PROGRESS_CLASS, PBS_VERTICAL, 36, 27, 13, 199 + CTEXT "100%", IDC_ST_PERCENTA, 32, 229, 21, 8, SS_LEFT + CTEXT "Process B", IDC_ST_PROCESSB, 79, 12, 35, 8, SS_LEFT + CONTROL "Progress", IDC_PBAR_PROCESSB, PROGRESS_CLASS, PBS_VERTICAL, 89, 27, 13, 199 + CTEXT "100%", IDC_ST_PERCENTB, 85, 229, 21, 8, SS_LEFT + CTEXT "Process C", IDC_ST_PROCESSC, 132, 12, 35, 8, SS_LEFT + CONTROL "Progress", IDC_PBAR_PROCESSC, PROGRESS_CLASS, PBS_VERTICAL, 142, 27, 13, 199 + CTEXT "100%", IDC_ST_PERCENTC, 139, 229, 21, 8, SS_LEFT + CTEXT "Process D", IDC_ST_PROCESSD, 184, 12, 35, 8, SS_LEFT + CONTROL "Progress", IDC_PBAR_PROCESSD, PROGRESS_CLASS, WS_BORDER | PBS_SMOOTH | PBS_VERTICAL, 195, 27, 13, 199 + CTEXT "100%", IDC_ST_PERCENTD, 192, 229, 21, 8, SS_LEFT + CTEXT "Process E", IDC_ST_PROCESSE, 236, 12, 35, 8, SS_LEFT + CONTROL "Progress", IDC_PBAR_PROCESSE, PROGRESS_CLASS, WS_BORDER | PBS_SMOOTH | PBS_VERTICAL, 248, 27, 13, 199 + CTEXT "100%", IDC_ST_PERCENTE, 244, 229, 21, 8, SS_LEFT } LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_TAB_DLG DIALOG 6, 15, 300, 250 -STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP -CAPTION "Tab Control" +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP FONT 9, "Arial" { CONTROL "Tab", IDC_TAB_MAIN, WC_TABCONTROL, WS_TABSTOP, 9, 19, 282, 215 - CONTROL "", IDC_PB_OWNERDRAW, WC_BUTTON, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 17, 63, 267, 162 + CONTROL "", IDC_PB_OWNERDRAW, WC_BUTTON, WS_TABSTOP | WS_TABSTOP | BS_OWNERDRAW, 17, 63, 267, 162 } LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_TRACKBAR_DLG DIALOG 6, 15, 300, 250 -STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP -CAPTION "Track Bar Control" +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP FONT 9, "Arial" { CONTROL "Slider", IDC_TB_HORZ_BOTTOM, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS, 10, 30, 119, 20 @@ -130,8 +125,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_TREEVIEW_DLG DIALOG 6, 15, 300, 250 -STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP -CAPTION "Tree View Control" +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP FONT 9, "Arial" { CONTROL "Tree", IDC_TV_MAIN, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS, 7, 7, 286, 236 |