/* taos_vp5.h TAOS 1.31+ include file to interface with Visual PRO/5 Version: 1.0 Written: May 8, 1997 Copyright (c) 1997 BASIS International Ltd. All rights reserved. Use of this file implies acceptance of all terms and conditions stated herein. The user agrees to indemnify BASIS International Ltd. from any liability which may arise from use of the file. This code is provided as is without any warranties, implied or otherwise. It may be freely used without charge. This code may only be used in PRO/5 and Visual PRO/5 environments. Attempting to incorporate this code in BBxPROGRESSION/4 run-time files will result in errors and possible corruption of data files. Do not use this code in any form or procedure which will be tokenized for and used in the BBxPROGRESSION/4 environment. */ /* These variable names are used by the following subroutines: rwi__sysgui rwi__sysgui_open rwi__platform$ rwi__sysgui_alias$ rwi__tsk$ rwi__context rwi__sysfin$ rwi__sysgui$ rwi__x rwi__y rwi__w rwi__h rwi__title$ rwi__event rwi__numeric_data rwi__string_data$ rwi__ctrl$ rwi__id rwi__convert_xy These function names are used (and defined): current_win change_to sysgui_width sysgui_height fnSysgui_Width fnSysgui_Height */ #define current_win rwi__context #define change_to(window_id) current_win=window_id; gosub change_window; #define sysgui_width fnSysgui_Width(0) #define sysgui_height fnSysgui_Height(0) subroutine open_sysgui { rwi__sysgui_open=0; rwi__platform$=info(0,0); if rwi__platform$(1,3)<>"WIN" then goto end_open_sysgui; rwi__alias=0; rwi__sysgui_alias$=""; init rwi__tsk$:"type:u(1),opens:u(1),name:c(1*=0),dname:c(1*=0),pname:c(1*=0),modes:c(1*=0)"; check_tsk: if rwi__sysgui_alias$<>"" then goto done_with_tsk; #3glbegin rwi__tsk$=tsk(rwi__alias,err=done_with_tsk) #3glend if rwi__sysgui_alias$="" then { if cvs(rwi__tsk.pname$,7)="SYSGUI" then { rwi__sysgui_alias$=rwi__tsk.name$; goto done_with_tsk; } } rwi__alias=rwi__alias+1; goto check_tsk; done_with_tsk: if rwi__sysgui_alias$="" then goto end_open_sysgui; #3glbegin rwi__sysgui=unt open (rwi__sysgui,err=end_open_sysgui)rwi__sysgui_alias$ #3glend rwi__sysgui_open=1; end_open_sysgui: } subroutine close_sysgui { if rwi__sysgui then { #3glbegin close (rwi__sysgui) #3glend rwi__sysgui=0; } } subroutine create_window { rwi__created=0; if rwi__sysgui then { rwi__x=abs(int(rwi__x)); rwi__y=abs(int(rwi__y)); if rwi__x=0 then rwi__x=20; if rwi__y=0 then rwi__y=20; rwi__w=abs(int(rwi__w)); rwi__h=abs(int(rwi__h)); if rwi__w=0 then rwi__w=sysgui_width-rwi__x; if rwi__h=0 then rwi__h=sysgui_height-rwi__y; #3glbegin dim rwi__sysfin$:tmpl(rwi__sysgui,ind=0) rwi__sysfin$=fin(rwi__sysgui,ind=0) current_win=rwi__sysfin.available_context print (rwi__sysgui,err=end_create_window)'context'(current_win) print (rwi__sysgui,err=end_create_window)'window'(rwi__x,rwi__y,rwi__w,rwi__h,rwi__title$,$$,$$) #3glend rwi__created=1; end_create_window: } } subroutine change_window { if rwi__sysgui then { #3glbegin print (rwi__sysgui,err=end_change_window)'context'(current_win) #3glend } end_change_window: } subroutine create_label { rwi__label_created=0; if rwi__sysgui then { rwi__w=abs(int(rwi__w)); rwi__h=abs(int(rwi__h)); if rwi__w=0 then rwi__w=50; if rwi__h=0 then rwi__h=25; rwi__x=abs(int(rwi__x)); rwi__y=abs(int(rwi__y)); if rwi__convert_xy then gosub convert_xy_coordinates; #3glbegin print (rwi__sysgui,err=end_create_label)'text'(rwi__id,rwi__x,rwi__y,rwi__w,rwi__h,rwi__title$,$$) #3glend rwi__label_created=1; } end_create_label: } subroutine create_edit { rwi__edit_created=0; if rwi__sysgui then { rwi__w=abs(int(rwi__w)); rwi__h=abs(int(rwi__h)); if rwi__w=0 then rwi__w=50; if rwi__h=0 then rwi__h=25; rwi__x=abs(int(rwi__x)); rwi__y=abs(int(rwi__y)); if rwi__convert_xy then gosub convert_xy_coordinates; #3glbegin print (rwi__sysgui,err=end_create_edit)'edit'(rwi__id,rwi__x,rwi__y,rwi__w,rwi__h,rwi__title$,$$) #3glend rwi__edit_created=1; } end_create_edit: } subroutine create_button { rwi__button_created=0; if rwi__sysgui then { rwi__w=abs(int(rwi__w)); rwi__h=abs(int(rwi__h)); if rwi__w=0 then rwi__w=50; if rwi__h=0 then rwi__h=25; rwi__x=abs(int(rwi__x)); rwi__y=abs(int(rwi__y)); if rwi__convert_xy then gosub convert_xy_coordinates; #3glbegin print (rwi__sysgui,err=end_create_button)'button'(rwi__id,rwi__x,rwi__y,rwi__w,rwi__h,rwi__title$,"") #3glend } end_create_button: } subroutine get_event { rwi__event=0; if rwi__sysgui then { #3glbegin dim rwi__event$:tmpl(rwi__sysgui,err=end_get_event) read record (rwi__sysgui,siz=10,err=end_get_event,tim=0)rwi__event$ #3glend rwi__event=1; } end_get_event: } subroutine get_numeric_data { rwi__numeric_data=0; rwi__ctrl$=""; if rwi__sysgui then { #3glbegin rwi__ctrl$=ctrl(rwi__sysgui,rwi__id,4,err=end_get_numeric_data) if rwi__ctrl$(2,1)<>$0A$ then goto end_get_numeric_data rwi__ctrl$=ctrl(rwi__sysgui,rwi__id,1) #3glend rwi__numeric_data=num(rwi__ctrl$,err=end_get_numeric_data); } end_get_numeric_data: } subroutine get_string_data { rwi__string_data$=""; rwi__ctrl$=""; if rwi__sysgui then { #3glbegin rwi__ctrl$=ctrl(rwi__sysgui,rwi__id,4,err=end_get_string_data) if dec($00$+rwi__ctrl$(2,1))<>16 then goto end_get_string_data rwi__string_data$=ctrl(rwi__sysgui,rwi__id,1) #3glend } end_get_string_data: } subroutine load_control { rwi__loaded=0; if rwi__sysgui then { #3glbegin print (rwi__sysgui,err=end_load_control)'title'(rwi__id,"") print (rwi__sysgui,err=end_load_control)'title'(rwi__id,rwi__title$) #3glend rwi__loaded=1; } end_load_control: } subroutine convert_xy_coordinates { if rwi__sysgui=0 then goto end_convert_xy_coordinates; rwi__x=int(rwi__x*(sysgui_width/80)); rwi__y=int(rwi__y*(sysgui_height/24)); rwi__w=int(rwi__w*(sysgui_width/80)); rwi__h=int(rwi__h*(sysgui_height/24)); end_convert_xy_coordinates: } #3glbegin def fnSysgui_Width(rwi__width_fn) if rwi__sysgui=0 then return 0 rwi__sysfin$=fin(rwi__sysgui,ind=0,err=end_fnSysgui_Width) return dec(rwi__sysfin$(24,2)) end_fnSysgui_Width: return 0 fnend def fnSysgui_Height(rwi__Height_fn) if rwi__sysgui=0 then return 0 rwi__sysfin$=fin(rwi__sysgui,ind=0,err=end_fnSysgui_Width) return dec(rwi__sysfin$(26,2)) end_fnSysgui_height: return 0 fnend #3glend