Path: utzoo!news-server.csri.toronto.edu!rutgers!usenet!ogicse!emory!sol.ctr.columbia.edu!bronze!silver!oecheruo From: oecheruo@silver.ucs.indiana.edu (Chima Echeruo) Newsgroups: comp.lang.pascal Subject: Re: TP type cast/conversion woes Message-ID: Date: 13 Mar 91 21:59:15 GMT References: <26261@adm.brl.mil> Sender: news@bronze.ucs.indiana.edu (USENET News System) Organization: Indiana University Lines: 91 CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) writes: ...[help about typecasts in pascal ]... >In article , oecheruo@silver.ucs.indiana.edu > (Chima Echeruo) wrote: >>I am working on a small windowing system for use in some educational >>applications. To handle the mouse I am using a freeware mouse TPU. >>My problem is that all the mouse routines take words while most of >>my own routine uses integers. For simple things like comparing an >>integer variable (say a window co-ord) with a word (say the mouse >>x-co-ord) the TP compiler produces incorrect code. >Type cast it--but beware of wrap around of words > MaxInt. Or just >assign it (same caveat). > some_int := some_word; > some_int := integer(some_word); Now there was the problem. I have recieved advice from a lot of kind people who point out that I can typecast integer type values by using word,integer etc.. >>some tips about how windows are implemented. I am most concerned >>about the sort of data structures that one would use to allow >>random access to any window. Right now, I use a simple fixed array >>but I cannot tell the order in which the windows were created since >>they new windows can be added anywhere in the array. >Hopefully your "simple fixed array" is an array of pointers, not of >the window structures themselves. That being the case, the cost of >swapping items in the array is trivial, and you can keep the array >ordered as you please--possibly with the topmost window having the >highest current index value. I used a fixed array but will now modify it to use an array of pointers to window strucs. then perhaps I will be able to sort on the fly without much swaping of data. >>secondly, how can one implement overlapping windows given the fact >>that the BGI graphics only understands one current window. I have >>avoided virtual windows that allow updating even when they are >>partially hidden. >I'm not very knowledgable about BGI, and haven't tried a graphics >window implementation myself. Can't you just use SetViewPort to >change from one window to another? (Obviously you'd be responsible >for saving and restoring overwritten window contents. I'd think >GetImage and PutImage would do well for that.) I have done that and it works great for small windows with a first-in-last out sequence. Clicking on an obscured window now brings it to the front and restore the client drawing space. However, ther are some problems with BGI viewport routines. 1) You cannot draw to an overlapped window without destroying the topmost one. That is , all viewports have to be rectangular and all drawing most take place in the foreground. 2) Most of the BitMap routines do not work properly. BitMaps that have parts of themselves exceeding the window boundry are not displayed and sometimes crash the system. 3) there is a no support of multiple windows or viewpoints in the BGI interface. 4) No virtual windows or buffers that store windows. >What version of TPas are you using? Do you have the documentation >for it? Oh yes, I'm legit. I've got the TP 5.0 package with manuals. I have resisted from buying thrid party books because I did not think that there was much I needed to get started. >+--------------------------------------------------------------------+ >| Karl Brendel Centers for Disease Control | >| Internet: CDCKAB@EMUVM1.BITNET Epidemiology Program Office | >| Bitnet: CDCKAB@EMUVM1 Atlanta, GA, USA | >| Home of Epi Info 5.0 | >+--------------------------------------------------------------------+ Thanks a lot for those who have helped out. -- ------------------------------------------------------------------------------- ----- Chima Oke Echeruo ----- oecheruo@silver.ucs.indiana.edu ++++++ oecheruo@amber.ucs.indiana.edu -------------------------------------------------------------------------------