исправлена работа кнопки подключения, патч для thinstation

This commit is contained in:
Alexander Zhirov 2023-02-22 18:40:30 +03:00
parent aba2893f98
commit fc2cb7ee29
2 changed files with 17 additions and 6 deletions

View file

@ -99,7 +99,7 @@ static int guiConnect(Ihandle *self)
return IUP_DEFAULT;
}
static void createHostsList(Ihandle *iupList)
static char* createHostsList(Ihandle *iupList)
{
Hosts *hosts = dbGetHostsList();
char *indexItem = NULL;
@ -120,6 +120,8 @@ static void createHostsList(Ihandle *iupList)
IupSetAttribute(iupList, "VALUE", serverName);
}
dbFreeHosts(hosts);
return serverName;
}
#ifdef IUP_WITH_LANGUAGE_KEYBOARD_ICON
@ -166,7 +168,7 @@ Ihandle* guiStart()
inputServer = IupList(NULL);
IupSetAttribute(inputServer, "NAME", "SERVER");
IupSetAttribute(inputServer, "TIP", "IP-адрес или имя удаленного сервера\n(обязательное для заполнения поле)");
createHostsList(inputServer);
char *hostname = createHostsList(inputServer);
IupSetAttribute(inputServer, "SIZE", "100");
IupSetAttribute(inputServer, "EDITBOX", "YES");
IupSetAttribute(inputServer, "DROPDOWN", "YES");
@ -182,7 +184,8 @@ Ihandle* guiStart()
inputUser = IupText(NULL);
IupSetAttribute(inputUser, "NAME", "USER");
IupSetAttribute(inputUser, "TIP", "<домен>\\<имя пользователя>\n<имя пользователя>@<домен>\n(обязательное для заполнения поле)");
IupSetAttribute(inputUser, "VALUE", getSetValueCurrent(PARAMETER_USERNAME));
char *username = getSetValueCurrent(PARAMETER_USERNAME);
IupSetAttribute(inputUser, "VALUE", username);
IupSetAttribute(inputUser, "SIZE", "100");
IupSetAttribute(inputUser, "MASK", "(/w|[/./\\/@/-])*");
IupSetCallback(inputUser, "ACTION", (Icallback) activeBtnConnect);
@ -222,6 +225,10 @@ Ihandle* guiStart()
IupSetHandle("CONNECT", btnConnect);
IupSetAttribute(btnConnect, "NAME", "CONNECT");
IupSetAttribute(btnConnect, "TIP", "Выполнить подключение");
if (username && hostname)
IupSetAttribute(btnConnect, "ACTIVE", "YES");
else
IupSetAttribute(btnConnect, "ACTIVE", "NO");
#ifdef IUP_WITH_COLOR_BUTTONS
IupSetAttribute(btnConnect, "BGCOLOR", "0 179 0");
IupSetAttribute(btnConnect, "FGCOLOR", "255 255 255");