About APM

Aquí puedes preguntar o compartir tus dudas y conocimientos acerca del programa
Hi :friends: about Plugin Maker who is named APM
I want to know how can Created ComboBox With an Item Text and Item Data in Plugin Properties in APM as the Same of that Picture :

Imagen


I Used this Code :

Código: Seleccionar todo

hWndControl = __Window.CreateWindowEx(0, "COMBOBOX", "TRUE FALSE",WS_CHILD+WS_VISIBLE+CBS_DROPDOWNLIST+CBS_SORT+WS_VSCROLL+CBS_HASSTRINGS,padding ,20,(300-padding),100,hWnd,0);
But I can't understand how to complete the missing part in code or in the way
Who can help me provide an example? :hypno:
and this is My Picture by Used above Code But i Can't insert any item text :

Imagen
hmm hey abood, unfortunately i dont have idea of api exposed by apm core but as far as everithing rely on winapi so you may send a message to this control with uMsg CB_ADDSTRING https://msdn.microsoft.com/es-es/librar ... s.85).aspx

As im more comfy using direct winapi stuff i suggest you to use luajit, and use some ffi binding for winapi stuff.

You have a good binding here https://github.com/Wiladams/LJIT2Win32 that exposes most of winapi, or even for a more complete library use luapower's winapi binding https://luapower.com/winapi you will find much easier handling winapi with complete control.
Thank you very much Pabloko you are more than wonderful Imagen
Yay stick to SendMessage(combobox_hwnd, 0x143(CB_ADDSTRING), null, ptr_to_global_string)
yes i used :

hWndControl = __Window.CreateWindowEx(0, "COMBOBOX", "Create \nObject Properties Here",WS_CHILD+WS_VISIBLE+CBS_DROPDOWNLIST+WS_VSCROLL,padding ,20,(300-padding),100,hWnd,0);
	__Window.SendMessage(hWndControl,CB_ADDSTRING,0,"abood 1987");
	__Window.SendMessage(hWndControl,CB_ADDSTRING,0,"welcome");


but i'm try to know how i can Get Text and how i can Create Color Button Such as Number2 in Picture1 :hypno:
Imagen
you are using most basic winapi to display combobox but theres tons of configs you can do to controls. in this case you want to custom draw the object instead letting windows doing it with default behabibour.

For that you need to control the message loop and catch WM_MEASUREITEM and WM_DRAWITEM messages coming from the combobox hwnd, ensure you remove default windows behavibour by returning true when these messages comes to the wndproc.

if you want to add custom background color for example, when you get the wm_drawitem, you will get also the hdc over wparam, so now you can call the gdi32 function SetBkColor or SetTextColor, but you will need more api also to create the color reference and locking&unlocking the hdc. Just take some winapi c example and translate to apm code.
Ok :yes: and i Will Look at this Code and i will tray to Understnd from this :

C++ Code :
case WM_COMMAND:
        switch (LOWORD(wParam)) 
        { 
            case IDCOMBO: 
                if (HIWORD(wParam) == CBN_SELENDOK) 
                { 
                    InitFoodList(hDlg); 
                    SendDlgItemMessage(hDlg, IDLIST, 
                        LB_SETCURSEL, 0, 0); 
                } 
                break; 
 
            case IDLIST: 
                if (HIWORD(wParam) != LBN_DBLCLK) 
                    break; 
 
            // For a double-click, process the OK case. 
            case IDOK: 
 
                // Get the text for the selected list item. 
                hwnd = GetDlgItem(hDlg, IDLIST); 

                // Here it is assumed the text can fit into achTemp.
                // If there is doubt, call LB_GETTEXTLENGTH first.
                SendMessage(hwnd, LB_GETTEXT, 
                    SendMessage(hwnd, LB_GETCURSEL, 0, 0), 
                    (LPARAM) achTemp); 
 
                // TODO: Do something with the selected text.
 
                EndDialog(hDlg, 0); 
                break; 
 
            case IDCANCEL: 
                hwnd = GetDlgItem(hDlg, IDCOMBO); 
                if (SendMessage(hwnd, CB_GETDROPPEDSTATE, 0, 0)) 
                    SendMessage(hwnd, CB_SHOWDROPDOWN, FALSE, 0); 
                else EndDialog(hDlg, 0); 
        } 
        break; 


From this Page : https://msdn.microsoft.com/en-us/librar ... s.85).aspx