home *** CD-ROM | disk | FTP | other *** search
/ BUG 4 / BUGCD1997_05.BIN / aplic / clip4win / clip4win.exe / C4W30E.HUF / SOURCE / ICONDEM2.PRG < prev    next >
Text File  |  1995-06-27  |  2KB  |  73 lines

  1. //    IconDem2.prg - Icon Demo (non-OO)
  2. //
  3. //    Written by:    John M. Skelton,  Mar-95.
  4. //
  5. //    Copyright (C) 1995 Skelton Software, Kendal Cottage, Hillam, Leeds LS25 5HP, UK.
  6. //    All Rights Reserved.
  7. //
  8. //    Part of Clip-4-Win.
  9.  
  10. #define    WIN_WANT_ALL
  11. #include "windows.ch"
  12. #define    NO_C4WCLASS
  13. #include "commands.ch"
  14. #include "icondemo.ch"
  15.  
  16.  
  17. function main()
  18. local    oApp, oWnd
  19.  
  20. CREATE APPLICATION oApp  WINDOW oWnd  TITLE "Clip-4-Win Icon Demo"    ;
  21.     ON INIT DemoDlg(oWnd)
  22.  
  23. return 0
  24.  
  25.  
  26. static function DemoDlg(oWnd)
  27. local    oDlg
  28.  
  29. CREATE DIALOG oDlg RESOURCE "IconDemoDlg"
  30.  
  31. @ ID ID_MDIFRAME ICON IN oDlg
  32.  
  33. @ ID ID_SHOW  BUTTON Show  IN oDlg
  34. @ ID ID_HIDE  BUTTON Hide  IN oDlg
  35. @ ID ID_ADD   BUTTON Add   IN oDlg
  36.  
  37. SHOW DIALOG oDlg IN oWnd
  38.  
  39. PostQuitMessage(0)
  40. return nil
  41.  
  42.  
  43. static function Show(hDlg)
  44. local    aIcons := {ID_MDIFRAME, ID_MDICHILD, ID_MDIDLG}
  45.  
  46. aeval(aIcons, {|nId, h| iif((h := GetDlgItem(hDlg, nId)) == 0, , ;
  47.                ShowWindow(h, SW_SHOW))})
  48. return nil
  49.  
  50.  
  51. static function Hide(hDlg)
  52. local    aIcons := {ID_MDIFRAME, ID_MDICHILD, ID_MDIDLG}
  53.  
  54. aeval(aIcons, {|nId, h| iif((h := GetDlgItem(hDlg, nId)) == 0, , ;
  55.                ShowWindow(h, SW_HIDE))})
  56. return nil
  57.  
  58.  
  59. static function Add(hDlg)
  60. local    aId    := {ID_MDIFRAME, ID_MDICHILD, ID_MDIDLG}, i, a
  61. local    aNames := {"MDIFRAME",  "MDICHILD",  "MDIDLG"}
  62.  
  63. for i = 1 to len(aNames)
  64.     if GetDlgItem(hDlg, aId[i]) == 0
  65.         // not there - create it
  66.         a = MapDialogRect(hDlg, {10, 40, 13, 13})
  67.         CreateWindow("static", aNames[i], CTL_DEFSTYLE + SS_ICON,;
  68.                      a[1] * i * 2, a[2], a[3], a[4], hDlg, aId[i])
  69.         exit
  70.     endif
  71. next i
  72. return nil
  73.