этом посте? Как отследить двойное нажатие по пункту из списка? Спасибо!
На этом примере (Отобразить)
CODE:
#define WS_VISIBLE 0x10000000
#define WS_CHILD 0x40000000
#define WS_BORDER 0x00800000
#define BS_MULTILINE 0x00002000
#define LB_ADDSTRING 0x0180
#define LB_GETCURSEL 0x0188
#define LB_SETCURSEL 0x0186
#define LBS_NOTIFY 0x0001
#define TRUE 1
#define WM_SETFONT 0x0030
#define RUSSIAN_CHARSET 204
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetWindowText", "GetWindowTextA", "User32.dll");
external(INT, "SetWindowText", "SetWindowTextA", "User32.dll");
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll");
external(INT, "GetWindowRect", "GetWindowRect", "User32.dll");
external(INT, "DeleteObject", "DeleteObject", "Gdi32.dll");
external(INT, "DeleteFile", "DeleteFileA", "kernel32.dll");
int h_font;
string rn = formatic(13)+formatic(10);
int dialogPosX_0 = 510, dialogPosY_0 = 428;
int button0[6];
int flag_button0[6] = { 0, 0, 0, 0, 0, 0 };
int listbox0[1];
int flag_listbox0[1] = { 0 };
string text_listbox0[1][5];
int count_rows_listbox0[1] = { 5 };
text_listbox0[0][0] = "0"; text_listbox0[0][1] = "1"; text_listbox0[0][2] = "2"; text_listbox0[0][3] = "3"; text_listbox0[0][4] = "4";
createdialog(0);
showdialog(0, "Диалог0", dialogPosX_0, dialogPosY_0, 262, 222, 4, 1);
loop()
{
// тут нужный код
sleep(10);
}
end_0:;
function getmessage(0, WM_CREATE)
{
int i;
int j;
char c_text_listbox[999];
h_font = CreateFont(-12, 0, 0, 0, 400, 0, 0, 0, RUSSIAN_CHARSET, 0, 0, 0, 0, "Arial");
button0[0] = CreateWindow(0, "BUTTON", "Button0", WS_VISIBLE | WS_CHILD, 4, 4, 80, 20, gethwnd(0), 0, 0, 0);
button0[1] = CreateWindow(0, "BUTTON", "Button1", WS_VISIBLE | WS_CHILD, 88, 4, 80, 20, gethwnd(0), 0, 0, 0);
button0[2] = CreateWindow(0, "BUTTON", "Button2", WS_VISIBLE | WS_CHILD, 172, 4, 80, 20, gethwnd(0), 0, 0, 0);
button0[3] = CreateWindow(0, "BUTTON", "Button3", WS_VISIBLE | WS_CHILD, 4, 168, 80, 20, gethwnd(0), 0, 0, 0);
button0[4] = CreateWindow(0, "BUTTON", "Button4", WS_VISIBLE | WS_CHILD, 88, 168, 80, 20, gethwnd(0), 0, 0, 0);
button0[5] = CreateWindow(0, "BUTTON", "Button5", WS_VISIBLE | WS_CHILD, 172, 168, 80, 20, gethwnd(0), 0, 0, 0);
listbox0[0] = CreateWindow(0, "LISTBOX", "", WS_VISIBLE | WS_CHILD | WS_BORDER | LBS_NOTIFY, 4, 28, 248, 144, gethwnd(0), 0, 0, 0);
for(i=0; i<1; i++)
{
for(j=0; j<count_rows_listbox0[i]; j++)
{
strcpy(#c_text_listbox[0], text_listbox0[i][j]);
sendmessage(LB_ADDSTRING, 0, address(#c_text_listbox[0]), formatiw(listbox0[i]));
}
}
for(i=0; i<1; i++)sendmessage(LB_SETCURSEL, flag_listbox0[i], 0, formatiw(listbox0[i]));
for(i=0; i<6; i++)sendmessage(WM_SETFONT, h_font, TRUE, formatiw(button0[i]));
for(i=0; i<1; i++)sendmessage(WM_SETFONT, h_font, TRUE, formatiw(listbox0[i]));
}
function getmessage(0, WM_COMMAND)
{
int i;
for(i=0; i<6; i++) // обработка нажатий кнопок
{
if(message.lparam == button0[i])
{
if(flag_button0[i])flag_button0[i] = 0;
else flag_button0[i] = 1;
return;
}
}
for(i=0; i<1; i++) // обработка нажатий на список listbox
{
if(message.lparam == listbox0[i])
{
flag_listbox0[i] = sendmessage(LB_GETCURSEL, 0, 0, formatiw(listbox0[i]));
return;
}
}
}
function getmessage(0, WM_CLOSE)
{
DeleteObject(h_font);
goto global end_0; // переход в метке
// close(); // закрыть кибор
}
#define WS_CHILD 0x40000000
#define WS_BORDER 0x00800000
#define BS_MULTILINE 0x00002000
#define LB_ADDSTRING 0x0180
#define LB_GETCURSEL 0x0188
#define LB_SETCURSEL 0x0186
#define LBS_NOTIFY 0x0001
#define TRUE 1
#define WM_SETFONT 0x0030
#define RUSSIAN_CHARSET 204
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetWindowText", "GetWindowTextA", "User32.dll");
external(INT, "SetWindowText", "SetWindowTextA", "User32.dll");
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll");
external(INT, "GetWindowRect", "GetWindowRect", "User32.dll");
external(INT, "DeleteObject", "DeleteObject", "Gdi32.dll");
external(INT, "DeleteFile", "DeleteFileA", "kernel32.dll");
int h_font;
string rn = formatic(13)+formatic(10);
int dialogPosX_0 = 510, dialogPosY_0 = 428;
int button0[6];
int flag_button0[6] = { 0, 0, 0, 0, 0, 0 };
int listbox0[1];
int flag_listbox0[1] = { 0 };
string text_listbox0[1][5];
int count_rows_listbox0[1] = { 5 };
text_listbox0[0][0] = "0"; text_listbox0[0][1] = "1"; text_listbox0[0][2] = "2"; text_listbox0[0][3] = "3"; text_listbox0[0][4] = "4";
createdialog(0);
showdialog(0, "Диалог0", dialogPosX_0, dialogPosY_0, 262, 222, 4, 1);
loop()
{
// тут нужный код
sleep(10);
}
end_0:;
function getmessage(0, WM_CREATE)
{
int i;
int j;
char c_text_listbox[999];
h_font = CreateFont(-12, 0, 0, 0, 400, 0, 0, 0, RUSSIAN_CHARSET, 0, 0, 0, 0, "Arial");
button0[0] = CreateWindow(0, "BUTTON", "Button0", WS_VISIBLE | WS_CHILD, 4, 4, 80, 20, gethwnd(0), 0, 0, 0);
button0[1] = CreateWindow(0, "BUTTON", "Button1", WS_VISIBLE | WS_CHILD, 88, 4, 80, 20, gethwnd(0), 0, 0, 0);
button0[2] = CreateWindow(0, "BUTTON", "Button2", WS_VISIBLE | WS_CHILD, 172, 4, 80, 20, gethwnd(0), 0, 0, 0);
button0[3] = CreateWindow(0, "BUTTON", "Button3", WS_VISIBLE | WS_CHILD, 4, 168, 80, 20, gethwnd(0), 0, 0, 0);
button0[4] = CreateWindow(0, "BUTTON", "Button4", WS_VISIBLE | WS_CHILD, 88, 168, 80, 20, gethwnd(0), 0, 0, 0);
button0[5] = CreateWindow(0, "BUTTON", "Button5", WS_VISIBLE | WS_CHILD, 172, 168, 80, 20, gethwnd(0), 0, 0, 0);
listbox0[0] = CreateWindow(0, "LISTBOX", "", WS_VISIBLE | WS_CHILD | WS_BORDER | LBS_NOTIFY, 4, 28, 248, 144, gethwnd(0), 0, 0, 0);
for(i=0; i<1; i++)
{
for(j=0; j<count_rows_listbox0[i]; j++)
{
strcpy(#c_text_listbox[0], text_listbox0[i][j]);
sendmessage(LB_ADDSTRING, 0, address(#c_text_listbox[0]), formatiw(listbox0[i]));
}
}
for(i=0; i<1; i++)sendmessage(LB_SETCURSEL, flag_listbox0[i], 0, formatiw(listbox0[i]));
for(i=0; i<6; i++)sendmessage(WM_SETFONT, h_font, TRUE, formatiw(button0[i]));
for(i=0; i<1; i++)sendmessage(WM_SETFONT, h_font, TRUE, formatiw(listbox0[i]));
}
function getmessage(0, WM_COMMAND)
{
int i;
for(i=0; i<6; i++) // обработка нажатий кнопок
{
if(message.lparam == button0[i])
{
if(flag_button0[i])flag_button0[i] = 0;
else flag_button0[i] = 1;
return;
}
}
for(i=0; i<1; i++) // обработка нажатий на список listbox
{
if(message.lparam == listbox0[i])
{
flag_listbox0[i] = sendmessage(LB_GETCURSEL, 0, 0, formatiw(listbox0[i]));
return;
}
}
}
function getmessage(0, WM_CLOSE)
{
DeleteObject(h_font);
goto global end_0; // переход в метке
// close(); // закрыть кибор
}