?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. WM_INITDIALOG = 272
  2. WM_COMMAND = 273
  3.  
  4. CB_RESETCONTENT = 331
  5. CB_ADDSTRING = 323
  6. CB_SELECTSTRING = 333
  7. CB_SETITEMHEIGHT = 339
  8. CB_GETCURSEL = 327
  9.  
  10. IDOK = 1
  11. IDCANCEL = 2
  12. IDC_TEXT1 = 101
  13. IDC_DROPLIST1 = 102
  14.  
  15. droplisttext = {
  16. "First line of text",
  17. "Second line of text",
  18. "Third line...",
  19. "Fourth...",
  20. "End of text for drop down list"
  21. }
  22.  
  23. function DlgProc ()
  24.  hwnd, msg, wParam, lParam = mappy.getDialogueParam ()
  25.  
  26. -- mappy.msgBox("Dialogue Example", "Vals = "..msg..", "..wParam..", "..lParam, mappy.MMB_OK, mappy.MMB_ICONINFO)
  27.  
  28.  if msg == WM_COMMAND then
  29.   idc = mappy.andVal (wParam, 65535)
  30.  
  31.   if idc == 99 then
  32.    mappy.sendDlgItemMessage (IDC_DROPLIST1, CB_RESETCONTENT, 0, 0)
  33.    for i = 1, table.getn(droplisttext) do
  34.     mappy.sendDlgItemMessage (IDC_DROPLIST1, CB_ADDSTRING, 0, droplisttext[i])
  35.    end
  36.    mappy.sendDlgItemMessage (IDC_DROPLIST1, CB_SETITEMHEIGHT, 0, 18)
  37.    mappy.sendDlgItemMessage (IDC_DROPLIST1, CB_SELECTSTRING, -1, droplisttext[1])
  38. --   mappy.msgBox("Dialogue Example", "Set "..table.getn(droplisttext).." strings", mappy.MMB_OK, mappy.MMB_ICONINFO)
  39.   end
  40.  
  41.   if idc == IDC_BUTTON1 then
  42.     mappy.msgBox("Dialogue Example", "Clicked button 1", mappy.MMB_OK, mappy.MMB_ICONINFO)
  43.   end
  44.  
  45.   if idc == IDOK then
  46.    listindex = mappy.sendDlgItemMessage (IDC_DROPLIST1, CB_GETCURSEL, 0, 0)
  47.    editstr = mappy.getDlgItemText (IDC_TEXT1)
  48.    mappy.msgBox("Dialogue Example", "Clicked OK, selected '"..droplisttext[listindex+1].."', typed '"..editstr.."'", mappy.MMB_OK, mappy.MMB_ICONINFO)
  49.   end
  50.  
  51.   if idc == IDCANCEL then
  52.    mappy.msgBox("Dialogue Example", "Clicked Cancel...", mappy.MMB_OK, mappy.MMB_ICONINFO)
  53.   end
  54.  
  55.  end
  56. end
  57.  
  58.  
  59. test, errormsg = pcall( DlgProc )
  60. if not test then
  61.     mappy.msgBox("Error ...", errormsg, mappy.MMB_OK, mappy.MMB_ICONEXCLAMATION)
  62. end
  63.  
  64.