EgtExecutor 1.9e2 :

- aggiunta alla funzione lua EgtDialogBox la possibilità di gestire dei combobox.
This commit is contained in:
Dario Sassi
2018-05-06 16:50:17 +00:00
parent 986be55ef8
commit 337413b847
3 changed files with 28 additions and 5 deletions
BIN
View File
Binary file not shown.
+28 -5
View File
@@ -26,6 +26,7 @@
#include "/EgtDev/Include/EgtPerfCounter.h"
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "Windowsx.h"
using namespace std ;
@@ -602,6 +603,7 @@ static int s_nCtrls = 0 ;
static string s_sCaption ;
static string s_sText[MAX_CTRLS] ;
static string s_sEdit[MAX_CTRLS] ;
static bool s_bCBox[MAX_CTRLS] ;
//-------------------------------------------------------------------------------
BOOL
@@ -629,11 +631,27 @@ CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
if ( i < s_nCtrls) {
SetDlgItemText( hwndDlg, IDC_TEXT1 + i, stringtoW( s_sText[i])) ;
SetDlgItemText( hwndDlg, IDC_EDIT1 + i, stringtoW( s_sEdit[i])) ;
if ( s_sEdit[i].find( "CB:") != 0) {
SetDlgItemText( hwndDlg, IDC_EDIT1 + i, stringtoW( s_sEdit[i])) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
s_bCBox[i] = false ;
}
else {
string sList = s_sEdit[i].substr( 3) ;
STRVECTOR vsVal ;
Tokenize( sList, ",", vsVal) ;
HWND hwndCBox = GetDlgItem( hwndDlg, IDC_COMBO1 + i) ;
for ( int j = 0 ; j < int( vsVal.size()) ; ++ j)
ComboBox_AddString( hwndCBox, stringtoW( vsVal[j])) ;
ComboBox_SetCurSel( hwndCBox, 0) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
s_bCBox[i] = true ;
}
}
else {
ShowWindow( GetDlgItem( hwndDlg, IDC_TEXT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
}
}
break ;
@@ -642,10 +660,15 @@ CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam
case IDOK :
for ( int i = 0 ; i < s_nCtrls ; ++ i) {
AtoWEX<128> wsEdit( "") ;
if ( GetDlgItemText( hwndDlg, IDC_EDIT1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit[i] = wstrztoA( wsEdit) ;
else
s_sEdit[i] = "" ;
s_sEdit[i] = "" ;
if ( ! s_bCBox[i]) {
if ( GetDlgItemText( hwndDlg, IDC_EDIT1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit[i] = wstrztoA( wsEdit) ;
}
else {
if ( GetDlgItemText( hwndDlg, IDC_COMBO1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit[i] = wstrztoA( wsEdit) ;
}
}
// continua di seguito
case IDCANCEL :
BIN
View File
Binary file not shown.