Fixups to generatelist & related handling of listbox type widgets
git-svn-id: svn://10.0.0.236/trunk@52826 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1405,126 +1405,6 @@ void CWizardMachineApp::BuildWidget(WIDGET* aWidget, CString iniSection, CString
|
||||
}
|
||||
|
||||
|
||||
void CWizardMachineApp::GenerateList(CString action, WIDGET* targetWidget, CString parentDirPath)
|
||||
{
|
||||
WIDGET* curWidget = targetWidget;
|
||||
|
||||
CFileFind fileList;
|
||||
BOOL dirFound = fileList.FindFile(parentDirPath);
|
||||
|
||||
if(curWidget->type == "CheckListBox")
|
||||
{
|
||||
((CCheckListBox*)curWidget->control)->ResetContent();
|
||||
}
|
||||
|
||||
if(curWidget->type == "ListBox")
|
||||
{
|
||||
((CListBox*)curWidget->control)->ResetContent();
|
||||
}
|
||||
|
||||
if(curWidget->type == "ComboBox")
|
||||
{
|
||||
((CComboBox*)curWidget->control)->ResetContent();
|
||||
}
|
||||
|
||||
|
||||
while (dirFound)
|
||||
{
|
||||
dirFound = fileList.FindNextFile();
|
||||
|
||||
if (action == "GenerateFileList")
|
||||
{
|
||||
if (!fileList.IsDirectory()) // skip if this is a dir
|
||||
{
|
||||
CString tmpFile = fileList.GetFileName();
|
||||
if(curWidget->type == "CheckListBox")
|
||||
{
|
||||
((CCheckListBox*)curWidget->control)->AddString(tmpFile);
|
||||
}
|
||||
|
||||
if(curWidget->type == "ListBox")
|
||||
{
|
||||
((CListBox*)curWidget->control)->AddString(tmpFile);
|
||||
}
|
||||
|
||||
if(curWidget->type == "ComboBox")
|
||||
{
|
||||
((CComboBox*)curWidget->control)->AddString(tmpFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (action == "GenerateDirList")
|
||||
{
|
||||
if (fileList.IsDirectory()) // skip if this is not a dir
|
||||
{
|
||||
CString tmpFile = fileList.GetFileName();
|
||||
if (!(tmpFile == "." || tmpFile == "..")) {
|
||||
if(curWidget->type == "CheckListBox")
|
||||
{
|
||||
((CCheckListBox*)curWidget->control)->AddString(tmpFile);
|
||||
}
|
||||
|
||||
if(curWidget->type == "ListBox")
|
||||
{
|
||||
((CListBox*)curWidget->control)->AddString(tmpFile);
|
||||
}
|
||||
|
||||
if(curWidget->type == "ComboBox")
|
||||
{
|
||||
((CComboBox*)curWidget->control)->AddString(tmpFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fileList.Close();
|
||||
|
||||
if(curWidget->type == "CheckListBox")
|
||||
{
|
||||
if (curWidget->value && curWidget->value != "")
|
||||
{
|
||||
char indices[MAX_SIZE];
|
||||
int i;
|
||||
|
||||
strcpy(indices, curWidget->value);
|
||||
char *s = strtok(indices, ",");
|
||||
for (; s; s=strtok(NULL, ","))
|
||||
{
|
||||
i = ((CCheckListBox*)curWidget->control)->FindString(0, s);
|
||||
if (i != -1)
|
||||
((CCheckListBox*)curWidget->control)->SetCheck(i, 1);
|
||||
}
|
||||
((CCheckListBox*)curWidget->control)->SetCurSel(0);
|
||||
}
|
||||
else
|
||||
((CCheckListBox*)curWidget->control)->SetCurSel(0);
|
||||
}
|
||||
if(curWidget->type == "ListBox")
|
||||
{
|
||||
if (curWidget->value && curWidget->value != "")
|
||||
{
|
||||
char indices[MAX_SIZE];
|
||||
|
||||
strcpy(indices, curWidget->value);
|
||||
char *s = strtok(indices, ",");
|
||||
for (; s; s=strtok(NULL, ","))
|
||||
((CListBox*)curWidget->control)->SelectString(0, s);
|
||||
}
|
||||
else
|
||||
((CListBox*)curWidget->control)->SetCurSel(0);
|
||||
}
|
||||
else if(curWidget->type == "ComboBox")
|
||||
{
|
||||
if (curWidget->value && curWidget->value != "")
|
||||
((CComboBox*)curWidget->control)->SelectString(-1, curWidget->value);
|
||||
else
|
||||
((CComboBox*)curWidget->control)->SetCurSel(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CWizardMachineApp::HelpWiz()
|
||||
{
|
||||
CString helpvalue = (CurrentNode->localVars->wizbut->help);
|
||||
|
||||
@@ -73,7 +73,6 @@ public:
|
||||
CString GetGlobalOptions(CString theName);
|
||||
void BuildWidget(WIDGET* aWidget, CString iniSection, CString iniFile, int pageBaseIndex, BOOL readValue);
|
||||
// void BuildHelpWidget(WIDGET* aWidget, CString iniSection, CString iniFile, int pageBaseIndex);
|
||||
void GenerateList(CString action, WIDGET* targetWidget, CString ext);
|
||||
void HelpWiz();
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
|
||||
@@ -341,6 +341,8 @@ BOOL CWizardUI::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
nID = LOWORD(wParam);
|
||||
wNotifyCode = HIWORD(wParam);
|
||||
WIDGET *w;
|
||||
|
||||
// Get screen values exchanged
|
||||
UpdateData(TRUE);
|
||||
|
||||
@@ -364,8 +366,22 @@ BOOL CWizardUI::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
else
|
||||
{
|
||||
if (curWidget->action.onCommand)
|
||||
{
|
||||
// Save any screen changes to affected widgets
|
||||
w = findWidget(curWidget->target);
|
||||
if (w)
|
||||
w->value = GetScreenValue(w);
|
||||
curWidget->value = GetScreenValue(curWidget);
|
||||
|
||||
// Evaluate new state
|
||||
theInterpreter->interpret(curWidget->action.onCommand, curWidget);
|
||||
|
||||
// Reflect new state into screen
|
||||
UpdateScreenWidget(curWidget);
|
||||
if (w)
|
||||
UpdateScreenWidget(w);
|
||||
}
|
||||
|
||||
if (curWidget->numOfOptDesc > 0)
|
||||
SetDescription(curWidget);
|
||||
}
|
||||
@@ -395,62 +411,6 @@ int TabSort(const void *w1, const void *w2)
|
||||
|
||||
void CWizardUI::SortWidgetsForTabOrder()
|
||||
{
|
||||
#ifdef USEOLDSORTCODEINSTEADOFBUILTINFUNCTION
|
||||
// Sort on y-coordinate
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int count = CurrentNode->numWidgets;
|
||||
for (x = count-1; x >= 0; x--) {
|
||||
BOOL flipped = FALSE;
|
||||
|
||||
for (int y = 0; y < x; y++) {
|
||||
WIDGET* widgetOne = CurrentNode->pageWidgets[y];
|
||||
WIDGET* widgetTwo = CurrentNode->pageWidgets[y+1];
|
||||
|
||||
if (widgetOne->location.y > widgetTwo->location.y)
|
||||
{
|
||||
WIDGET* T = widgetOne;
|
||||
CurrentNode->pageWidgets[y] = widgetTwo;
|
||||
CurrentNode->pageWidgets[y+1] = T;
|
||||
|
||||
flipped = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flipped) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort on x-coordinate
|
||||
x = 0;
|
||||
y = 0;
|
||||
for (x = count-1; x >= 0; x--) {
|
||||
BOOL flipped = FALSE;
|
||||
|
||||
for (int y = 0; y < x; y++) {
|
||||
WIDGET* widgetOne = CurrentNode->pageWidgets[y];
|
||||
WIDGET* widgetTwo = CurrentNode->pageWidgets[y+1];
|
||||
|
||||
if (widgetOne->location.y == widgetTwo->location.y)
|
||||
{
|
||||
if (widgetOne->location.x > widgetTwo->location.x)
|
||||
{
|
||||
WIDGET* T = widgetOne;
|
||||
CurrentNode->pageWidgets[y] = widgetTwo;
|
||||
CurrentNode->pageWidgets[y+1] = T;
|
||||
|
||||
flipped = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flipped) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
qsort(CurrentNode->pageWidgets, CurrentNode->numWidgets, sizeof(WIDGET *), TabSort);
|
||||
CurrentNode->isWidgetsSorted = TRUE;
|
||||
}
|
||||
@@ -461,8 +421,8 @@ void CWizardUI::EnableWidget(WIDGET *curWidget)
|
||||
int enabled = TRUE;
|
||||
if (!curWidget->action.onInit.IsEmpty())
|
||||
{
|
||||
CString enableStr = theInterpreter->replaceVars(curWidget->action.onInit,NULL);
|
||||
// Cheat the interpret overhead since this is called a lot!
|
||||
CString enableStr = theInterpreter->replaceVars(curWidget->action.onInit,NULL);
|
||||
if (enableStr == "Enable(0)")
|
||||
enabled = FALSE;
|
||||
else if (enableStr == "Enable2()")
|
||||
@@ -471,6 +431,93 @@ void CWizardUI::EnableWidget(WIDGET *curWidget)
|
||||
}
|
||||
}
|
||||
|
||||
void CWizardUI::UpdateScreenWidget(WIDGET *curWidget)
|
||||
{
|
||||
int selRv = CB_ERR;
|
||||
int selectedSomething = FALSE;
|
||||
|
||||
if(curWidget->type == "CheckListBox")
|
||||
{
|
||||
int selected = ((CCheckListBox*)curWidget->control)->GetCurSel();
|
||||
if (selected == CB_ERR)
|
||||
selected = 0;
|
||||
|
||||
((CCheckListBox*)curWidget->control)->ResetContent();
|
||||
|
||||
for (int i = 0; i < curWidget->numOfOptions; i++)
|
||||
if (curWidget->options.value[i])
|
||||
((CCheckListBox*)curWidget->control)->AddString(curWidget->options.value[i]);
|
||||
|
||||
if (curWidget->value && curWidget->value != "")
|
||||
{
|
||||
char indices[MAX_SIZE];
|
||||
int i;
|
||||
|
||||
strcpy(indices, curWidget->value);
|
||||
char *s = strtok(indices, ",");
|
||||
for (; s; s=strtok(NULL, ","))
|
||||
{
|
||||
i = ((CCheckListBox*)curWidget->control)->FindString(0, s);
|
||||
if (i != -1)
|
||||
{
|
||||
((CCheckListBox*)curWidget->control)->SetCheck(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
selRv = ((CCheckListBox*)curWidget->control)->SetCurSel(selected);
|
||||
if (selRv == CB_ERR)
|
||||
((CCheckListBox*)curWidget->control)->SetCurSel(0);
|
||||
|
||||
if (curWidget->numOfOptDesc > 0)
|
||||
SetDescription(curWidget);
|
||||
}
|
||||
if(curWidget->type == "ListBox")
|
||||
{
|
||||
((CListBox*)curWidget->control)->ResetContent();
|
||||
|
||||
for (int i = 0; i < curWidget->numOfOptions; i++)
|
||||
if (curWidget->options.value[i])
|
||||
((CListBox*)curWidget->control)->AddString(curWidget->options.value[i]);
|
||||
|
||||
if (curWidget->value && curWidget->value != "")
|
||||
{
|
||||
char indices[MAX_SIZE];
|
||||
|
||||
strcpy(indices, curWidget->value);
|
||||
char *s = strtok(indices, ",");
|
||||
for (; s; s=strtok(NULL, ","))
|
||||
{
|
||||
selRv = ((CListBox*)curWidget->control)->SelectString(0, s);
|
||||
if (selRv != LB_ERR)
|
||||
selectedSomething = TRUE;
|
||||
}
|
||||
}
|
||||
if (!selectedSomething)
|
||||
selRv = ((CListBox*)curWidget->control)->SetCurSel(0);
|
||||
}
|
||||
else if(curWidget->type == "ComboBox")
|
||||
{
|
||||
int selected = ((CComboBox*)curWidget->control)->GetCurSel();
|
||||
if (selected == CB_ERR)
|
||||
selected = 0;
|
||||
|
||||
((CComboBox*)curWidget->control)->ResetContent();
|
||||
|
||||
for (int i = 0; i < curWidget->numOfOptions; i++)
|
||||
if (curWidget->options.value[i])
|
||||
((CComboBox*)curWidget->control)->AddString(curWidget->options.value[i]);
|
||||
|
||||
if (curWidget->value && curWidget->value != "")
|
||||
selRv = ((CComboBox*)curWidget->control)->SelectString(-1, curWidget->value);
|
||||
|
||||
if (selRv == CB_ERR)
|
||||
selRv = ((CComboBox*)curWidget->control)->SetCurSel(selected);
|
||||
if (selRv == CB_ERR)
|
||||
((CComboBox*)curWidget->control)->SetCurSel(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CWizardUI::CreateControls()
|
||||
{
|
||||
int rv;
|
||||
@@ -517,12 +564,10 @@ void CWizardUI::CreateControls()
|
||||
if (widgetType == "Text" || widgetType == "BoldText" || widgetType == "DynamicText") {
|
||||
curWidget->control = new CStatic;
|
||||
rv = ((CStatic*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID);
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
else if (widgetType == "Navigation Text") {
|
||||
curWidget->control = new CNavText;
|
||||
rv = ((CNavText*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID);
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
else if (widgetType == "EditBox") {
|
||||
curWidget->control = new CEdit;//Added new style parameter ES_AUTOHSCROLL- to allow *GASP* SCROLLING!!
|
||||
@@ -545,14 +590,12 @@ void CWizardUI::CreateControls()
|
||||
//Set maximum number of characters allowed per line - limit set to 200
|
||||
((CEdit*)curWidget->control)->SetLimitText(int(curWidget->fieldlen.length));
|
||||
((CEdit*)curWidget->control)->SetWindowText(curWidget->value);
|
||||
EnableWidget(curWidget);
|
||||
((CEdit*)curWidget->control)->SetModify(FALSE);
|
||||
}
|
||||
}
|
||||
else if (widgetType == "Button") {
|
||||
curWidget->control = new CButton;
|
||||
rv = ((CButton*)curWidget->control)->Create(curWidget->value, BS_PUSHBUTTON | WS_TABSTOP, tmpRect, this, ID);
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
else if (widgetType == "RadioButton") {
|
||||
curWidget->control = new CButton;
|
||||
@@ -624,53 +667,21 @@ void CWizardUI::CreateControls()
|
||||
else {
|
||||
((CButton*)curWidget->control)->SetCheck(0);
|
||||
}
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
else if (widgetType == "CheckBox") {
|
||||
curWidget->control = new CButton;
|
||||
rv = ((CButton*)curWidget->control)->Create(curWidget->title, BS_AUTOCHECKBOX | WS_TABSTOP, tmpRect, this, ID);
|
||||
((CButton*)curWidget->control)->SetCheck(atoi(curWidget->value));
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
else if (widgetType == "ListBox")
|
||||
{
|
||||
curWidget->control = new CListBox;
|
||||
rv = ((CListBox*)curWidget->control)->Create(LBS_STANDARD | LBS_MULTIPLESEL | WS_HSCROLL | WS_VSCROLL | WS_TABSTOP, tmpRect, this, ID);
|
||||
rv = ((CListBox*)curWidget->control)->Create(
|
||||
LBS_STANDARD | // LBS_MULTIPLESEL |
|
||||
WS_HSCROLL | WS_VSCROLL | WS_TABSTOP,
|
||||
tmpRect, this, ID);
|
||||
((CListBox*)curWidget->control)->ModifyStyleEx(NULL, WS_EX_CLIENTEDGE, 0);
|
||||
|
||||
/*
|
||||
if (curWidget->action.onInit == "GenerateFileList" ||
|
||||
curWidget->action.onInit == "GenerateDirList")
|
||||
{
|
||||
CString ext = theInterpreter->replaceVars(curWidget->action.parameters,NULL);
|
||||
theApp.GenerateList(curWidget->action.onInit, curWidget, ext);
|
||||
}
|
||||
if (!curWidget->action.onInit.IsEmpty())
|
||||
theInterpreter->interpret(curWidget->action.onInit, curWidget);
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < curWidget->numOfOptions; i++)
|
||||
{
|
||||
if (curWidget->options.value[i])
|
||||
{
|
||||
((CListBox*)curWidget->control)->AddString(curWidget->options.value[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char* selectedItems;
|
||||
selectedItems = (char *) GlobalAlloc(0, curWidget->value.GetLength()+1);
|
||||
strcpy(selectedItems, (char *) (LPCTSTR) curWidget->value);
|
||||
|
||||
char *s = strtok(selectedItems, ",");
|
||||
while (s)
|
||||
{
|
||||
((CListBox*)curWidget->control)->SelectString(0, s);
|
||||
s = strtok( NULL, "," );
|
||||
}
|
||||
*/
|
||||
//GlobalFree(selectedItems);
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
else if (widgetType == "CheckListBox")
|
||||
{
|
||||
@@ -682,23 +693,19 @@ void CWizardUI::CreateControls()
|
||||
tmpRect, this, ID);
|
||||
((CCheckListBox*)curWidget->control)->ModifyStyleEx(NULL, WS_EX_CLIENTEDGE, 0);
|
||||
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
else if (widgetType == "ComboBox") {
|
||||
curWidget->control = new CComboBox;
|
||||
rv = ((CComboBox*)curWidget->control)->Create(CBS_DROPDOWNLIST | WS_TABSTOP, tmpRect, this, ID);
|
||||
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
else if (widgetType == "GroupBox") {
|
||||
curWidget->control = new CButton;
|
||||
rv = ((CButton*)curWidget->control)->Create(curWidget->value, BS_GROUPBOX, tmpRect, this, ID);
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
else if (widgetType == "ProgressBar") {
|
||||
curWidget->control = new CProgressCtrl;
|
||||
rv = ((CProgressCtrl*)curWidget->control)->Create(WS_TABSTOP, tmpRect, this, ID);
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
|
||||
|
||||
@@ -709,11 +716,7 @@ void CWizardUI::CreateControls()
|
||||
}
|
||||
else
|
||||
|
||||
// Set the font of the widget and increment the dynamically assigned ID value
|
||||
/*
|
||||
if ((curWidget->description == "Navigation Status")
|
||||
|| (curWidget->description == "Current Page")) {
|
||||
*/
|
||||
// Set the font of the widget
|
||||
if (curWidget->type == "BoldText")
|
||||
{
|
||||
curWidget->control->SetFont(m_pNavFont);
|
||||
@@ -730,81 +733,15 @@ void CWizardUI::CreateControls()
|
||||
WIDGET* curWidget = CurrentNode->pageWidgets[x];
|
||||
CString widgetType = curWidget->type;
|
||||
|
||||
if (widgetType == "ListBox")
|
||||
{
|
||||
if (!curWidget->action.onInit.IsEmpty())
|
||||
theInterpreter->interpret(curWidget->action.onInit, curWidget);
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < curWidget->numOfOptions; i++)
|
||||
{
|
||||
if (curWidget->options.value[i])
|
||||
{
|
||||
((CListBox*)curWidget->control)->AddString(curWidget->options.value[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char* selectedItems;
|
||||
selectedItems = (char *) GlobalAlloc(0, curWidget->value.GetLength()+1);
|
||||
strcpy(selectedItems, (char *) (LPCTSTR) curWidget->value);
|
||||
if (!curWidget->action.onInit.IsEmpty())
|
||||
theInterpreter->interpret(curWidget->action.onInit, curWidget);
|
||||
|
||||
char *s = strtok(selectedItems, ",");
|
||||
while (s)
|
||||
{
|
||||
((CListBox*)curWidget->control)->SelectString(0, s);
|
||||
s = strtok( NULL, "," );
|
||||
}
|
||||
}
|
||||
else if (widgetType == "CheckListBox")
|
||||
{
|
||||
if (!curWidget->action.onInit.IsEmpty())
|
||||
theInterpreter->interpret(curWidget->action.onInit, curWidget);
|
||||
for (int i = 0; i < curWidget->numOfOptions; i++)
|
||||
{
|
||||
if (curWidget->options.value[i])
|
||||
{
|
||||
((CCheckListBox*)curWidget->control)->AddString(curWidget->options.value[i]);
|
||||
}
|
||||
}
|
||||
|
||||
char* selectedItems;
|
||||
selectedItems = (char *) GlobalAlloc(0, curWidget->value.GetLength()+1);
|
||||
strcpy(selectedItems, (char *) (LPCTSTR) curWidget->value);
|
||||
|
||||
int idx;
|
||||
BOOL selected = FALSE;
|
||||
char *s = strtok(selectedItems, ",");
|
||||
while (s)
|
||||
{
|
||||
if (!selected)
|
||||
{
|
||||
selected = TRUE;
|
||||
((CCheckListBox*)curWidget->control)->SelectString(0, s);
|
||||
}
|
||||
idx = ((CCheckListBox*)curWidget->control)->FindString(0, s);
|
||||
if (idx != -1)
|
||||
((CCheckListBox*)curWidget->control)->SetCheck(idx, 1);
|
||||
s = strtok( NULL, "," );
|
||||
}
|
||||
if (curWidget->numOfOptDesc > 0)
|
||||
SetDescription(curWidget);
|
||||
}
|
||||
else if (widgetType == "ComboBox") {
|
||||
if (!curWidget->action.onInit.IsEmpty())
|
||||
theInterpreter->interpret(curWidget->action.onInit, curWidget);
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < curWidget->numOfOptions; i++)
|
||||
{
|
||||
if (curWidget->options.value[i])
|
||||
{
|
||||
((CComboBox*)curWidget->control)->AddString(curWidget->options.value[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateScreenWidget(curWidget);
|
||||
}
|
||||
|
||||
// Handle enablement AFTER all initializations completed...
|
||||
for (x = 0; x < m_pControlCount; x++)
|
||||
EnableWidget(CurrentNode->pageWidgets[x]);
|
||||
}
|
||||
|
||||
void CWizardUI::DisplayControls()
|
||||
@@ -946,21 +883,31 @@ CString CWizardUI::GetScreenValue(WIDGET *curWidget)
|
||||
{
|
||||
LPINT choices;
|
||||
|
||||
int count;
|
||||
count = (((CListBox *)curWidget->control))->GetSelCount();
|
||||
choices = (int *) GlobalAlloc(0, count * sizeof(LPINT));
|
||||
((CListBox *)curWidget->control)->GetSelItems(count, choices);
|
||||
|
||||
rv = "";
|
||||
CString temp;
|
||||
for (int i=0; i < count; i++)
|
||||
if (FALSE /* MULTIPLESEL something or other */ )
|
||||
{
|
||||
((CListBox *)curWidget->control)->GetText(choices[i], temp);
|
||||
rv = rv + temp;
|
||||
if ( i+1 < count)
|
||||
rv += ",";
|
||||
int count;
|
||||
count = (((CListBox *)curWidget->control))->GetSelCount();
|
||||
choices = (int *) GlobalAlloc(0, count * sizeof(LPINT));
|
||||
((CListBox *)curWidget->control)->GetSelItems(count, choices);
|
||||
|
||||
rv = "";
|
||||
CString temp;
|
||||
for (int i=0; i < count; i++)
|
||||
{
|
||||
((CListBox *)curWidget->control)->GetText(choices[i], temp);
|
||||
rv = rv + temp;
|
||||
if ( i+1 < count)
|
||||
rv += ",";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int selected = ((CListBox *)curWidget->control)->GetCurSel();
|
||||
if (selected == LB_ERR)
|
||||
rv = "";
|
||||
else
|
||||
((CListBox *)curWidget->control)->GetText(selected, rv);
|
||||
}
|
||||
//GlobalFree(choices);
|
||||
}
|
||||
else if (widgetType == "CheckListBox")
|
||||
{
|
||||
|
||||
@@ -82,6 +82,7 @@ public:
|
||||
BOOL SetDescription(WIDGET *w);
|
||||
void SortWidgetsForTabOrder();
|
||||
void EnableWidget(WIDGET *curWidget);
|
||||
void UpdateScreenWidget(WIDGET *curWidget);
|
||||
void CreateControls();
|
||||
void DisplayControls();
|
||||
void UpdateGlobals();
|
||||
|
||||
@@ -330,6 +330,33 @@ BOOL CInterpret::OpenBrowser(const char *url)
|
||||
|
||||
return retflag;
|
||||
}
|
||||
|
||||
void CInterpret::GenerateList(CString action, WIDGET* curWidget, CString parentDirPath)
|
||||
{
|
||||
CFileFind fileList;
|
||||
BOOL dirFound = fileList.FindFile(parentDirPath);
|
||||
CString tmpFile;
|
||||
int i = 0;
|
||||
|
||||
while (dirFound)
|
||||
{
|
||||
dirFound = fileList.FindNextFile();
|
||||
tmpFile = fileList.GetFileName();
|
||||
|
||||
if (action == "GenerateFileList" && !fileList.IsDirectory() ||
|
||||
action == "GenerateDirList" && fileList.IsDirectory() &&
|
||||
!(tmpFile == "." || tmpFile == ".."))
|
||||
{
|
||||
curWidget->options.value[i] = new char[tmpFile.GetLength()+1];
|
||||
strcpy(curWidget->options.value[i], (char *)(LPCTSTR) tmpFile);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
curWidget->numOfOptions = i;
|
||||
|
||||
fileList.Close();
|
||||
}
|
||||
|
||||
CString CInterpret::replaceVars(CString str, char *listval)
|
||||
{
|
||||
char *theStr = (char *) (LPCTSTR) str;
|
||||
@@ -752,7 +779,8 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
||||
}
|
||||
// Delete the global var now...
|
||||
}
|
||||
else if (strcmp(pcmd, "GenerateFileList") == 0 || strcmp(pcmd, "GenerateDirList") == 0)
|
||||
else if (strcmp(pcmd, "GenerateFileList") == 0 ||
|
||||
strcmp(pcmd, "GenerateDirList") == 0)
|
||||
{
|
||||
char *p2 = strchr(parms, ',');
|
||||
|
||||
@@ -769,7 +797,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
||||
if (w)
|
||||
{
|
||||
CString p2path = replaceVars(p2,NULL);
|
||||
theApp.GenerateList(pcmd, w, p2path);
|
||||
GenerateList(pcmd, w, p2path);
|
||||
}
|
||||
}
|
||||
else if (strcmp(pcmd, "BrowseFile") == 0)
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
BOOL NewConfig(WIDGET *curWidget, CString globalsName, CString DialogTitle);
|
||||
BOOL BrowseFile(WIDGET *curWidget);
|
||||
CString BrowseDir(WIDGET *curWidget);
|
||||
void GenerateList(CString action, WIDGET* curWidget, CString ext);
|
||||
BOOL Progress(); // Not actually used right now
|
||||
BOOL IterateListBox(char *parms);
|
||||
CString replaceVars(CString str, char *listval);
|
||||
|
||||
Reference in New Issue
Block a user