home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18866 < prev    next >
Encoding:
Text File  |  1992-12-24  |  2.9 KB  |  107 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!wupost!spool.mu.edu!torn!newshub.ccs.yorku.ca!wc8519
  3. From: wc8519@writer.yorku.ca (Colin Beckmann)
  4. Subject: Graphics in C C++
  5. Message-ID: <1992Dec24.162212.12596@newshub.ccs.yorku.ca>
  6. Sender: news@newshub.ccs.yorku.ca (USENET News System)
  7. Organization: York University
  8. Distribution: na
  9. Date: Thu, 24 Dec 1992 16:22:12 GMT
  10. Lines: 95
  11.  
  12.     I am trying to learn a little about GUI in C-C++ and have been 
  13. reading  two books by James McCord  "C Programmers Guide to Graphics" and
  14. "Borland C++ Programmers Guide to Graphics"  The first does not go into 
  15. mice in any form but the second provides a model of a graphical user 
  16. interface.  I thought  this is **GREAT**. :-). One problem, "it don't
  17. work,Ma" and I, being a mere lowly apprentice don't know how to fix it. :-( 
  18. Perhaps someone out there can help me with this problem.I am using Borlands
  19. 3.1 and source code settings are for C++ since I am using BGI graphics .
  20. Your help is greatly appreciated.  Replys can either go to the net or email 
  21. me directly.  The solution is probably quite simple and I am going to 
  22. look like the rank amature that I am by if you never ask you'll never know.
  23. Thanks in advance. 
  24.  
  25.  
  26. The offending code seems to be
  27.  
  28.         /* This function is used to communicate with the mouse     */
  29.         /* via interrrupt 0x33h                                                */
  30.  
  31. void mouse_call (regax, regbx, regcx, regdx)
  32. {
  33.     union REGS inregs, outregs ;
  34.  
  35.     inregs.x.ax = regax ;
  36.     inregs.x.bx = regbx ;
  37.     inregs.x.cx = regcx ;
  38.     inregs.x.dx = regdx ;
  39.  
  40.     int86 (0x33, &inregs, &outregs) ;
  41.  
  42.     globax = outregs.x.ax ;
  43.     globbx = outregs.x.bx ;
  44.     globcx = outregs.x.cx ;
  45.     globdx = outregs.x.dx ;
  46. }
  47.  
  48. which was ment to work with 
  49.  
  50.  
  51. void get_demo_option (void)
  52. {
  53.     do
  54.     {
  55.         mouse_call (5,0,0,0) ;
  56.         update_pos () ;
  57.     }    while (globbx == 0) ;
  58.  
  59.     bar (1,21,638,445) ;
  60.     if (globcx >= 20 && globcx <= 180 && globdx >= 20 && globdx <= 39)
  61.     {
  62.         putimage (100,100, dialog_box, COPY_PUT) ;
  63.         monitor_dialog () ;
  64.     }
  65.  
  66.     if (globcx >= 20 && globcx <= 180 && globdx >= 40 && globdx <= 59)
  67.     {
  68.         putimage (100,100, scroll_bar, COPY_PUT) ;
  69.         monitor_scroll () ;
  70.     }
  71.  
  72.     if (globcx >= 20 && globcx <= 180 && globdx >= 60 && globdx <= 79)
  73.     {
  74.         putimage (100,100, radio_button, COPY_PUT) ;
  75.         monitor_radio () ;
  76.     }
  77.  
  78.     if (globcx >= 20 && globcx <= 180 && globdx >= 80 && globdx <= 99)
  79.     {
  80.         draw_tool () ;
  81.     }
  82.  
  83.     if (globcx >= 20 && globcx <= 180 && globdx >= 100 && globdx <= 120)
  84.     {
  85.         clear_screen () ;
  86.     }
  87. }
  88.  
  89. This was to activate part of a pull down menu.
  90. I know that the old style function def for mouse_call was obsolete and and
  91. the program would not run.  I changed it to 
  92.  
  93. void mouse_call (int regax, int regbx, int regcx, int regdx)
  94.  
  95. and the program would compile but the clicking the button does not do
  96. much.  The program displays the x y coordinates of the mouse and the mouse
  97. is where they say it is.  The program was apparently written for Borland
  98. 2.0 
  99. Any help would be appreciated.
  100. Happy Holidays
  101.  
  102. Colin
  103.  
  104. email  wc8519@grant.yorku.ca
  105.  
  106.  
  107.