Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

edmlonce.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

LONG MLCreate (PED ped, LPCREATESTRUCT lpCreateStruct)


Function Documentation

LONG MLCreate PED  ped,
LPCREATESTRUCT  lpCreateStruct
 

Definition at line 23 of file edmlonce.c.

References tagED::cchTextMax, tagED::chLines, ClearWindowState(), tagED::cLines, ECCreate(), ECSetFont(), ECSetText(), FALSE, tagED::fAutoHScroll, tagED::fAutoVScroll, tagED::format, tagED::fWrap, gHighestUserAddress, LPICH, MAXTEXT, NULL, tagED::pwnd, REBASEPTR, TRUE, and WFHSCROLL.

Referenced by MLEditWndProc().

00026 { 00027 LONG windowStyle; 00028 LPWSTR lpszName; 00029 00030 /* 00031 * Get values from the window instance data structure and put them in the 00032 * ped so that we can access them easier 00033 */ 00034 windowStyle = ped->pwnd->style; 00035 00036 /* 00037 * Do the standard creation stuff 00038 */ 00039 if (!ECCreate(ped, windowStyle)) { 00040 return (-1); 00041 } 00042 00043 /* 00044 * Allocate line start array in local heap and lock it down 00045 */ 00046 ped->chLines = (LPICH)LocalAlloc(LPTR, 2 * sizeof(int)); 00047 if (ped->chLines == NULL) { 00048 return (-1); 00049 } 00050 00051 /* 00052 * Call it one line of text... 00053 */ 00054 ped->cLines = 1; 00055 00056 /* 00057 * If app wants WS_VSCROLL or WS_HSCROLL, it automatically gets AutoVScroll 00058 * or AutoHScroll. 00059 */ 00060 if ((windowStyle & ES_AUTOVSCROLL) || (windowStyle & WS_VSCROLL)) { 00061 ped->fAutoVScroll = 1; 00062 } 00063 00064 if (ped->format != ES_LEFT) 00065 { 00066 /* 00067 * If user wants right or center justified text, then we turn off 00068 * AUTOHSCROLL and WS_HSCROLL since non-left styles don't make sense 00069 * otherwise. 00070 */ 00071 windowStyle &= ~WS_HSCROLL; 00072 ClearWindowState(ped->pwnd, WFHSCROLL); 00073 ped->fAutoHScroll = FALSE; 00074 } 00075 else if (windowStyle & WS_HSCROLL) { 00076 ped->fAutoHScroll = TRUE; 00077 } 00078 00079 ped->fWrap = (!ped->fAutoHScroll && !(windowStyle & WS_HSCROLL)); 00080 00081 /* 00082 * Max # chars we will allow user to enter 00083 */ 00084 ped->cchTextMax = MAXTEXT; 00085 00086 /* 00087 * Set the default font to be the system font. 00088 */ 00089 ECSetFont(ped, NULL, FALSE) ; 00090 00091 /* 00092 * Set the window text if needed and notify parent if not enough memory to 00093 * set the initial text. 00094 */ 00095 if ((ULONG_PTR)lpCreateStruct->lpszName > gHighestUserAddress) 00096 lpszName = REBASEPTR(ped->pwnd, (PVOID)lpCreateStruct->lpszName); 00097 else 00098 lpszName = (LPWSTR)lpCreateStruct->lpszName; 00099 if (!ECSetText(ped, (LPSTR)lpszName)) 00100 return (-1); 00101 00102 return (TRUE); 00103 }


Generated on Sat May 15 19:43:32 2004 for test by doxygen 1.3.7