diff --git a/Contrib/InstallOptions/Changelog.txt b/Contrib/InstallOptions/Changelog.txt index fa117061..16b565ff 100644 --- a/Contrib/InstallOptions/Changelog.txt +++ b/Contrib/InstallOptions/Changelog.txt @@ -1,3 +1,9 @@ +DLL version 2.2 (6/10/2003) +* \r\n converts to newline in Multiline edit box +* Support for multiline edit box +* Better tab order in DirRequest and FileRequest +* Minor fixes + DLL version 2.1 (3/15/2003) * \r\n converts to newline in both label Text and ValidateText * New browse dialog style (modern) diff --git a/Contrib/InstallOptions/InstallerOptions.cpp b/Contrib/InstallOptions/InstallerOptions.cpp index 48c95efa..d9203470 100644 --- a/Contrib/InstallOptions/InstallerOptions.cpp +++ b/Contrib/InstallOptions/InstallerOptions.cpp @@ -71,7 +71,7 @@ char *STRDUP(const char *c) // text box flags #define FLAG_PASSWORD 0x00000040 #define FLAG_ONLYNUMBERS 0x00000080 -//#define FLAG_MULTILINE 0x00000100 +#define FLAG_MULTILINE 0x00000100 // listbox flags #define FLAG_MULTISELECT 0x00000200 @@ -89,6 +89,11 @@ char *STRDUP(const char *c) // OFN_EXPLORER 0x00080000 +// more text box flags +#define FLAG_WANTRETURN 0x00100000 +#define FLAG_VSCROLL 0x00200000 +#define FLAG_HSCROLL 0x00400000 + struct TableEntry { char *pszName; int nValue; @@ -310,9 +315,13 @@ bool SaveSettings(void) { char *pszBuffer = (char*)MALLOC(nBufLen); if (!pszBuffer) return false; + int CurrField = 1; for(nIdx = 0; nIdx < nNumFields; nIdx++) { + if ( pFields[nIdx].nType == FIELD_BROWSEBUTTON ) + continue; + hwnd = pFields[nIdx].hwnd; - wsprintf(szField, "Field %d", nIdx + 1); + wsprintf(szField, "Field %d", CurrField); switch(pFields[nIdx].nType) { case FIELD_CHECKBOX: case FIELD_RADIOBUTTON: @@ -363,11 +372,40 @@ bool SaveSettings(void) { pszBuffer = (char*)MALLOC(nBufLen); if (!pszBuffer) return false; } - GetWindowText(hwnd, pszBuffer, nBufLen); + *pszBuffer='"'; + GetWindowText(hwnd, pszBuffer+1, nBufLen-1); + pszBuffer[nLength+1]='"'; + pszBuffer[nLength+2]='\0'; + if ( pFields[nIdx].nType == FIELD_TEXT && pFields[nIdx].nFlags & FLAG_MULTILINE ) + { + char *pszBuf2 = (char*)MALLOC(nBufLen*2); // double the size, consider the worst case, all chars are \r\n + char *p1, *p2; + for (p1=pszBuffer,p2=pszBuf2; *p1; p1++, p2++) { + if (*p1 == '\r') { + *p2++ = '\\'; + *p2 = 'r'; + } + else if (*p1 == '\n') { + *p2++ = '\\'; + *p2 = 'n'; + } + else if (*p1 == '\t') { + *p2++ = '\\'; + *p2 = 't'; + } + else + *p2=*p1; + } + *p2 = 0; + nBufLen = nBufLen*2; + FREE(pszBuffer); + pszBuffer=pszBuf2; + } break; } } WritePrivateProfileString(szField, "STATE", pszBuffer, pszFilename); + CurrField++; } FREE(pszBuffer); @@ -389,8 +427,20 @@ void AddBrowseButtons() { switch (pFields[nIdx].nType) { case FIELD_FILEREQUEST: case FIELD_DIRREQUEST: - pNewField = &pFields[nNumFields]; - // nNumFields functions as the index of the new control, increment at *end* of loop + // Insert button after edit, tabstop depends in creation order, + // with this trick browse button get tabstop after parent edit + if ( nIdx < nNumFields - 1 ) + { + CopyMemory(&pFields[nIdx+2], &pFields[nIdx+1], (nNumFields-nIdx-1)*sizeof(FieldType) ); + for ( int i = nIdx+2; i < nNumFields; i++ ) + { + if ( pFields[i].nType == FIELD_BROWSEBUTTON ) + pFields[i].nParentIdx++; // Ohh! where is your dady :) + } + } + // After moving controls 1 position, don't forget to increment nNumFields at *end* of loop + pNewField = &pFields[nIdx+1]; + ZeroMemory(pNewField, sizeof(FieldType)); // don't use settings from other control pNewField->nControlID = 1200 + nNumFields; pNewField->nParentIdx = nIdx; pNewField->nType = FIELD_BROWSEBUTTON; @@ -398,7 +448,7 @@ void AddBrowseButtons() { //pNewField->pszListItems = NULL; //pNewField->nMaxLength = 0; //pNewField->nMinLength = 0; - pNewField->pszText = szBrowseButtonCaption; //STRDUP("..."); + pNewField->pszText = STRDUP(szBrowseButtonCaption); // needed for generic FREE //pNewField->pszValidateText = NULL; pNewField->rect.right = pFields[nIdx].rect.right; @@ -491,7 +541,10 @@ bool ReadSettings(void) { { "DISABLED", FLAG_DISABLED }, { "NOTABSTOP", FLAG_NOTABSTOP }, { "ONLY_NUMBERS", FLAG_ONLYNUMBERS }, - //{ "MULTILINE", FLAG_MULTILINE }, + { "MULTILINE", FLAG_MULTILINE }, + { "VSCROLL", FLAG_VSCROLL }, + { "HSCROLL", FLAG_HSCROLL }, + { "WANTRETURN", FLAG_WANTRETURN }, { NULL, 0 } }; @@ -858,8 +911,17 @@ int createCfgDlg() dwStyle |= ES_PASSWORD; if (pFields[nIdx].nFlags & FLAG_ONLYNUMBERS) dwStyle |= ES_NUMBER; - /*if (pFields[nIdx].nFlags & FLAG_MULTILINE) - dwStyle |= ES_WANTRETURN | ES_MULTILINE;*/ + if (pFields[nIdx].nFlags & FLAG_MULTILINE) + { + dwStyle |= ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL; + ConvertNewLines(pFields[nIdx].pszState); + } + if ( pFields[nIdx].nFlags & FLAG_WANTRETURN ) + dwStyle |= ES_WANTRETURN; + if (pFields[nIdx].nFlags & FLAG_VSCROLL) + dwStyle |= WS_VSCROLL; + if (pFields[nIdx].nFlags & FLAG_HSCROLL) + dwStyle |= WS_HSCROLL; title = pFields[nIdx].pszState; break; case FIELD_COMBOBOX: diff --git a/Contrib/InstallOptions/Readme.html b/Contrib/InstallOptions/Readme.html index ac7e07b2..a586fc0f 100644 --- a/Contrib/InstallOptions/Readme.html +++ b/Contrib/InstallOptions/Readme.html @@ -394,7 +394,7 @@ numbers from 1 to NumFields. Each Field section can contain the following values
ReadINIStr $R0 "$PLUGINSDIR\test.ini" "Field 1" "State"+
Important Note:
+For Multiline edit +boxe's the output "State" comes with "\r\n" if text as more +than one line and is your responsiblity to convert it inside script to +"$\r$\n" if needed! example macro:
+NORMALIZE_CRCF VALUE + push $1 ; Index + push $2 ; Output char by char + push $3 ; Output char by char next + push $4 ; Text Accumulator + + StrCpy $1 "0" +DONEXT: + StrCpy $2 ${VALUE} 1 $1 + IntOp $1 $1 + 1 + StrCpy $3 ${VALUE} 1 $1 + StrCmp $3 "" EOT + StrCmp $2 "\" 0 NORMAL_CHAR + StrCmp $3 "r" FOUND_CR + StrCmp $3 "n" 0 NORMAL_CHAR +;FOUND_LF: + StrCpy $4 "$4$\r" + IntOp $1 $1 + 1 + goto DONEXT + +FOUND_CR: + StrCpy $4 "$4$\n" + IntOp $1 $1 + 1 + goto DONEXT + +NORMAL_CHAR: + StrCpy $4 "$4$2" + goto DONEXT + +EOT: + StrCpy ${VALUE} $4 + pop $4 + pop $3 + pop $2 + pop $1 + +!macroend ++
Validate the input
If you want to validate the input on the page, for example, you want to check whether the user has filled in @@ -535,6 +579,15 @@ FunctionEnd
Version history