EgtExecutor :

- nel dialogo lua ora si ripristina sempre la selezione iniziale, anche con selezione negli edit.
This commit is contained in:
Dario Sassi
2026-07-27 09:49:12 +02:00
parent 9c132984d9
commit 231e879592
+35 -14
View File
@@ -37,16 +37,17 @@ enum TYPE_CTRLS { CTRL_NONE = 0, CTRL_CHECK = 1, CTRL_COMBO = 2, CTRL_EDIT = 3,
const char* SEC_SCENE = "Scene" ;
const char* KEY_CUSTOMCOLORS = "CustomColors" ;
// Variabili Globali
static HWND s_hDlg = NULL ;
static string s_sCaption ;
static int s_nCtrls = 0 ;
static string s_sText[MAX_CTRLS] ;
static string s_sEdit[MAX_CTRLS] ;
static int s_nType[MAX_CTRLS] ;
static bool s_bOk = false ; // uscita con Ok
static bool s_bCustomColorsInit = false ; // flag di inizializzazione colori custom
static COLORREF s_CustomColors[16] = {12632256} ; // 16 colori GRAY
static int s_nDlgSelItem = -1 ; // indice dell'Item di selezione
static HWND s_hDlg = NULL ;
static string s_sCaption ;
static int s_nCtrls = 0 ;
static string s_sText[MAX_CTRLS] ;
static string s_sEdit[MAX_CTRLS] ;
static int s_nType[MAX_CTRLS] ;
static bool s_bOk = false ; // uscita con Ok
static bool s_bCustomColorsInit = false ; // flag di inizializzazione colori custom
static COLORREF s_CustomColors[16] = {12632256} ; // 16 colori GRAY
static int s_nDlgSelItem = -1 ; // indice dell'Item di selezione
static INTVECTOR s_vSelIds ; // vettore degli oggetti precedentemente selezionati
//-----------------------------------------------------------------------------
static string
@@ -95,9 +96,21 @@ StartSelectionMode( HWND hDlg, int nEditId)
}
}
// seleziono solo gli elementi presenti nell'edit corrispondente
// salvo la selezione corrente
s_vSelIds.clear() ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
if ( pGeomDB != nullptr) {
s_vSelIds.reserve( pGeomDB->GetSelectedObjNbr()) ;
int nSelId = pGeomDB->GetFirstSelectedObj() ;
while ( nSelId != GDB_ID_NULL) {
s_vSelIds.push_back( nSelId) ;
nSelId = pGeomDB->GetNextSelectedObj() ;
}
}
// seleziono solo gli elementi presenti nell'edit corrispondente (avendo messo s_nDlgSelItem = -1 il testo non viene modificato)
s_nDlgSelItem = - 1 ;
ExeDeselectAll() ; // !<-- NB. avendo messo s_nDlgSelItem = -1 il testo non viene rimosso
ExeDeselectAll() ;
AtoWEX<128> wsEdit( "") ;
GetDlgItemText( hDlg, nEditId, LPWSTR( wsEdit), 128) ;
ValidateSelection( wstrztoA( wsEdit), true) ;
@@ -117,6 +130,7 @@ EndSelectionMode( HWND hDlg)
if ( s_nDlgSelItem == -1)
return ;
// termine selezione
s_nDlgSelItem = -1 ;
// disabilito tutti gli edit associati ai BS
@@ -132,8 +146,15 @@ EndSelectionMode( HWND hDlg)
HWND hMain = GetParent( hDlg) ;
EnableWindow( hMain, FALSE) ;
SetFocus( hDlg) ;
// deseleziono tutto
ExeDeselectAll() ; //!<-- NB. avendo messo s_nDlgSelItem = -1 il testo non viene rimosso
// ripristino selezione originale (avendo messo s_nDlgSelItem = -1 il testo non viene modificato)
ExeDeselectAll() ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
if ( pGeomDB != nullptr) {
for ( int nSelId : s_vSelIds)
pGeomDB->SelectObj( nSelId) ;
}
s_vSelIds.clear() ;
ExeDraw() ;
}