Changeset 80
- Timestamp:
- Jun 4, 2001, 9:13:58 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dialog.c
r79 r80 957 957 /* 958 958 *@@ dlghCreateDlg: 959 * replacement for WinCreateDlg for creating a dialog960 * from a settings array in memory, which is formatted961 * automatically.959 * replacement for WinCreateDlg/WinLoadDlg for creating a 960 * dialog from a settings array in memory, which is 961 * formatted automatically. 962 962 * 963 963 * This does NOT use regular dialog templates from … … 977 977 * Like WinLoadDlg, this creates a standard WC_FRAME and 978 978 * subclasses it with fnwpMyDlgProc. It then sends WM_INITDLG 979 * to the dialog with pCreateParams in mp2. You can use 980 * WinProcessDlg as usual. In your dlg proc, use WinDefDlgProc 981 * as usual. 979 * to the dialog with pCreateParams in mp2. 980 * 981 * If this func returns no error, you can then use 982 * WinProcessDlg with the newly created dialog as usual. In 983 * your dlg proc, use WinDefDlgProc as usual. 982 984 * 983 985 * There is NO run-time overhead after creation; after this … … 994 996 * at compile time. 995 997 * 998 * Essentially, such a dialog item operates similarly to 999 * HTML tables. There are rows and columns in the table, 1000 * and each control which is specified must be a column 1001 * in some table. Tables may also nest (see below). 1002 * 996 1003 * The macros are: 997 1004 * … … 999 1006 * but must each be properly terminated with END_TABLE. 1000 1007 * 1001 * -- START_ROW(fl) starts a new row in a table. 1008 * -- START_GROUP_TABLE(pDef) starts a group. This 1009 * behaves exacly like START_TABLE, but in addition, 1010 * it produces a static group control around the table. 1011 * Useful for group boxes. pDef must point to a 1012 * _CONTROLDEF describing the control to be used for 1013 * the group (usually a WC_STATIC with SS_GROUP style), 1014 * whose size parameter is ignored. 1015 * 1016 * As with START_TABLE, START_GROUP_TABLE must be 1017 * terminated with END_TABLE. 1018 * 1019 * -- START_ROW(fl) starts a new row in a table (regular 1020 * or group). This must also be the first item after 1021 * the (group) table tag. 1002 1022 * 1003 1023 * fl specifies formatting flags for the row. This 1004 1024 * can be one of ROW_VALIGN_BOTTOM, ROW_VALIGN_CENTER, 1005 1025 * ROW_VALIGN_TOP and affects all items in the control. 1006 *1007 * -- START_GROUP_TABLE(pDef) starts a group. This1008 * behaves exacly like START_TABLE, but in addition,1009 * it produces a control around the table. Useful1010 * for group boxes. pDef must point to a _CONTROLDEF,1011 * whose size parameter is ignored.1012 *1013 * This must also be terminated with END_TABLE.1014 1026 * 1015 1027 * -- CONTROL_DEF(pDef) defines a control in a table row. … … 1021 1033 * Instead, the structure only contains the _size_ 1022 1034 * of the control. All positions are computed by 1023 * this function, depending on the positionof the1024 * control and itsnesting within the various tables.1035 * this function, depending on the sizes of the 1036 * controls and their nesting within the various tables. 1025 1037 * 1026 1038 * If you specify SZL_AUTOSIZE, the size of the 1027 1039 * control is even computed automatically. Presently, 1028 * this only works for statics with SS_TEXT and 1029 * SS_BITMAP. 1030 * 1031 * Unless separated with TYPE_START_NEW_ROW items, 1032 * subsequent control items will be considered 1033 * to be in the same row (== positioned next to 1034 * each other). 1040 * this only works for statics with SS_TEXT, SS_ICON, 1041 * and SS_BITMAP. 1042 * 1043 * Unless separated with START_ROW items, subsequent 1044 * control items will be considered to be in the same 1045 * row (== positioned next to each other). 1035 1046 * 1036 1047 * There are a few rules, whose violation will produce … … 1075 1086 + DLGHITEM DlgTemplate[] = 1076 1087 + { 1077 + START_TABLE, // root table, must exist1078 + START_ROW(0), // row 1 in the root table 1088 + START_TABLE, // root table, required 1089 + START_ROW(0), // row 1 in the root table, required 1079 1090 + // create group on top 1080 1091 + (1) START_GROUP_TABLE(&Group), … … 1153 1164 + fnwpMyDlgProc, 1154 1165 + "My Dlg Title", 1155 + G_aMyDialogTemplate,1156 + ARRAYITEMSIZE( G_aMyDialogTemplate),1166 + DlgTemplate, // DLGHITEM array 1167 + ARRAYITEMSIZE(DlgTemplate), 1157 1168 + NULL)) 1158 1169 + { 1159 + ULONG idReturn = WinProcessDlg( pDlgData->hwndDlg);1170 + ULONG idReturn = WinProcessDlg(hwndDlg); 1160 1171 + WinDestroyWindow(hwndDlg); 1161 1172 + } … … 1378 1389 else 1379 1390 { 1391 HWND hwndDlg = pDlgData->hwndDlg; 1380 1392 SIZEL szlClient = {0}; 1381 1393 RECTL rclClient; … … 1383 1395 1384 1396 /* 1385 * 3) compute size of client after computing all control sizes1397 * 3) compute size of all controls 1386 1398 * 1387 1399 */ … … 1394 1406 WinReleasePS(pDlgData->hps); 1395 1407 1396 WinSubclassWindow(pDlgData->hwndDlg, pfnwpDialogProc); 1408 /* 1409 * 4) compute size of dialog client from total 1410 * size of all controls 1411 */ 1412 1413 WinSubclassWindow(hwndDlg, pfnwpDialogProc); 1397 1414 1398 1415 // calculate the frame size from the client size … … 1401 1418 rclClient.xRight = szlClient.cx + 2 * SPACING; 1402 1419 rclClient.yTop = szlClient.cy + 2 * SPACING; 1403 WinCalcFrameRect( pDlgData->hwndDlg,1420 WinCalcFrameRect(hwndDlg, 1404 1421 &rclClient, 1405 1422 FALSE); // frame from client 1406 1423 1407 WinSetWindowPos( pDlgData->hwndDlg,1424 WinSetWindowPos(hwndDlg, 1408 1425 0, 1409 1426 10, … … 1414 1431 1415 1432 /* 1416 * 4) compute positionsof all controls1433 * 5) compute _positions_ of all controls 1417 1434 * 1418 1435 */ … … 1423 1440 1424 1441 /* 1425 * 5) create control windows, finally1442 * 6) create control windows, finally 1426 1443 * 1427 1444 */ … … 1435 1452 1436 1453 /* 1437 * 6) WM_INITDLG, set focus1454 * 7) WM_INITDLG, set focus 1438 1455 * 1439 1456 */ … … 1441 1458 hwndFocusItem = (pDlgData->hwndFirstFocus) 1442 1459 ? pDlgData->hwndFirstFocus 1443 : pDlgData->hwndDlg;1444 if (!WinSendMsg( pDlgData->hwndDlg,1460 : hwndDlg; 1461 if (!WinSendMsg(hwndDlg, 1445 1462 WM_INITDLG, 1446 1463 (MPARAM)hwndFocusItem,
Note:
See TracChangeset
for help on using the changeset viewer.