home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / HISOFT.LZH / HISOFT_A.MSA / HGT / DIALOG.BAS < prev    next >
BASIC Source File  |  1991-10-10  |  2KB  |  68 lines

  1.  
  2. ' an additional GEM call is needed as the built-in form_alert expects a
  3. ' BASIC-style string, not a pointer to a C-type string
  4. FUNCTION newform_alertaddr(BYVAL button,BYVAL addr&)
  5.     POKEW PEEKL(GB+8),button    'int_in
  6.     POKEL PEEKL(GB+16),addr&    'addr_in
  7.     GEMSYS(52)
  8.     newform_alertaddr=PEEKW(PEEKL(GB+12))        'int_out!
  9. END FUNCTION
  10.  
  11. FUNCTION Newform_alert(BYVAL num,BYVAL button)
  12. STATIC junk,alertaddr&
  13. junk=rsrc_gaddr(type_string,num,alertaddr&)
  14. junk=Newform_alertAddr(button,alertaddr&)
  15. Newform_Alert=junk
  16. END FUNCTION
  17.  
  18. ' a general routine to produce a dialog box and handle interaction
  19. ' the return result is the exit object number
  20. FUNCTION HandleDialog(BYVAL editnum)
  21. STATIC x,y,w,h,but
  22. form_center tree&,x,y,w,h
  23. form_dial FMD_START,0,0,0,0,x,y,w,h
  24. form_dial FMD_GROW,x+w\2,y+h\2,0,0,x,y,w,h
  25. junk=objc_draw(tree&,0,10,x,y,w,h)
  26. but=form_do(tree&,editnum) AND &h7fff
  27. form_dial FMD_SHRINK,x+w\2,y+h\2,0,0,x,y,w,h
  28. form_dial FMD_FINISH,0,0,0,0,x,y,w,h
  29. IF Getob_type(but)=G_BUTTON THEN
  30.     Exclob_state but,mask_selected
  31. END IF
  32. HandleDialog=but
  33. END FUNCTION
  34.  
  35. 'Set a tedinfo field to a numeric value
  36. SUB SetTedNumber(BYVAL object,BYVAL value#)
  37. Sette_ptext object,MID$(STR$(value#),2)
  38. END SUB
  39.  
  40. 'Return a numeric value from a tedinfo field
  41. FUNCTION GetTedNumber#(BYVAL object)
  42. GetTedNumber#=VAL(Gette_ptext$(object))
  43. END FUNCTION
  44.  
  45. ' select a particular radio button in a group
  46. SUB SetButton(BYVAL parent,BYVAL button)
  47. STATIC b,t&
  48. b=Getob_head(parent)        'head object number
  49. DO UNTIL b=parent
  50.     IF b=button THEN
  51.         Inclob_state b,mask_selected
  52.     ELSE
  53.         Exclob_state b,mask_selected
  54.     END IF
  55.     b=Getob_next(b)
  56. LOOP
  57. END SUB
  58.  
  59. ' return which button of a group is selected
  60. FUNCTION GetButton(BYVAL parent)
  61. STATIC b
  62. b=Getob_head(parent)        'head object number
  63. DO UNTIL (b=parent) OR Curob_state(b,mask_selected)
  64.     b=Getob_next(b)
  65. LOOP
  66. GetButton=b
  67. END FUNCTION
  68.