Changeset 106 for trunk/src/helpers/dialog.c
- Timestamp:
- Oct 2, 2001, 8:28:47 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dialog.c
r105 r106 1778 1778 { 1779 1779 CHAR szErr[300]; 1780 sprintf(szErr, "Error %d occured in dlghCreateDlg.", arc);1780 sprintf(szErr, "Error %d occured in " __FUNCTION__ ".", arc); 1781 1781 winhDebugBox(hwndOwner, 1782 "Error in Dialog Manager", 1783 szErr); 1784 } 1785 1786 return (arc); 1787 } 1788 1789 /* 1790 *@@ dlghFormatDlg: 1791 * similar to dlghCreateDlg in that this can 1792 * dynamically format dialog items. 1793 * 1794 * The differences however are the following: 1795 * 1796 * -- This assumes that hwndDlg already points 1797 * to a valid dialog frame and that this 1798 * dialog should be modified according to 1799 * flFlags. 1800 * 1801 * flFlags can be any combination of the following: 1802 * 1803 * -- DFFL_CREATECONTROLS: paDlgItems points to 1804 * an array of cDlgItems DLGHITEM structures 1805 * (see dlghCreateDlg) which is used for creating 1806 * subwindows in hwndDlg. By using this flag, the 1807 * function will essentially work like dlghCreateDlg, 1808 * except that the frame is already created. 1809 * 1810 * -- DFFL_RESIZEFRAME: hwndDlg should be resized so 1811 * that it will properly surround the controls. 1812 * 1813 * This can only be used in conjunction with 1814 * DFFL_RESIZEFRAME. 1815 * 1816 *@@added V0.9.16 (2001-09-29) [umoeller] 1817 */ 1818 1819 APIRET dlghFormatDlg(HWND hwndDlg, // in: dialog frame to work on 1820 PDLGHITEM paDlgItems, // in: definition array 1821 ULONG cDlgItems, // in: array item count (NOT array size) 1822 const char *pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT 1823 ULONG flFlags) // in: DFFL_* flags 1824 { 1825 APIRET arc = NO_ERROR; 1826 1827 ULONG ul; 1828 1829 PDLGPRIVATE pDlgData = NULL; 1830 1831 /* 1832 * 1) parse the table and create structures from it 1833 * 1834 */ 1835 1836 if (!(arc = Dlg0_Init(&pDlgData, 1837 pcszControlsFont))) 1838 { 1839 if (!(arc = Dlg1_ParseTables(pDlgData, 1840 paDlgItems, 1841 cDlgItems))) 1842 { 1843 /* 1844 * 2) create empty dialog frame 1845 * 1846 */ 1847 1848 HWND hwndFocusItem = NULLHANDLE; 1849 SIZEL szlClient = {0}; 1850 RECTL rclClient; 1851 1852 pDlgData->hwndDlg = hwndDlg; 1853 1854 /* 1855 * 3) compute size of all controls 1856 * 1857 */ 1858 1859 Dlg2_CalcSizes(pDlgData, 1860 &szlClient); 1861 1862 // WinSubclassWindow(hwndDlg, pfnwpDialogProc); 1863 1864 /* 1865 * 4) compute size of dialog client from total 1866 * size of all controls 1867 */ 1868 1869 if (flFlags & DFFL_RESIZEFRAME) 1870 { 1871 // calculate the frame size from the client size 1872 rclClient.xLeft = 10; 1873 rclClient.yBottom = 10; 1874 rclClient.xRight = szlClient.cx + 2 * SPACING; 1875 rclClient.yTop = szlClient.cy + 2 * SPACING; 1876 WinCalcFrameRect(hwndDlg, 1877 &rclClient, 1878 FALSE); // frame from client 1879 1880 WinSetWindowPos(hwndDlg, 1881 0, 1882 10, 1883 10, 1884 rclClient.xRight, 1885 rclClient.yTop, 1886 SWP_MOVE | SWP_SIZE | SWP_NOADJUST); 1887 } 1888 1889 if (flFlags & DFFL_CREATECONTROLS) 1890 { 1891 if (!(arc = Dlg3_PositionAndCreate(pDlgData, 1892 &szlClient, 1893 &hwndFocusItem))) 1894 WinSetFocus(HWND_DESKTOP, hwndFocusItem); 1895 } 1896 } 1897 1898 Dlg9_Cleanup(&pDlgData); 1899 } 1900 1901 if (arc) 1902 { 1903 CHAR szErr[300]; 1904 sprintf(szErr, "Error %d occured in " __FUNCTION__ ".", arc); 1905 winhDebugBox(NULLHANDLE, 1782 1906 "Error in Dialog Manager", 1783 1907 szErr);
Note:
See TracChangeset
for help on using the changeset viewer.