home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-28 | 499.7 KB | 16,280 lines |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TEGL Windows Toolkit II
- Release 1.10
-
-
- Programmer's Reference Guide
- for TURBO PASCAL 5.0/5.5
- and QUICK PASCAL 1.0
-
-
-
- Copyright (C) 1990, TEGL Systems Corporation
- All rights reserved
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TEGL Systems Corporation
- Suite 780, 789 West Pender Street
- Vancouver, British Columbia
- Canada V6C 1H2
-
-
-
-
-
-
-
-
-
-
-
-
- TEGL Windows Toolkit II
-
- LICENSE AGREEMENT
-
- TEGL software products are protected under both Canada copyright
- law and international treaty provisions.
-
- You have the non-exclusive right to use the enclosed software under the
- following terms and conditions.
-
- You may use this software on a single machine, for both personal and
- business use; and may make copies of the software solely for backup
- purposes. Other than this you agree to use this software "like a book",
- meaning the software may be used by any number of people and may be moved
- from one computer to another so long as there is no possibility of it being
- used by more than one person at one time.
-
- Programs that you write and compile using the TEGL Windows Toolkit may be
- used, given away, or sold without additional license or fees as long as
- all copies of such programs bear a copyright notice. By "copyright notice"
- we mean either your own copyright notice or if you prefer, the following
- statement, "Created using TEGL Windows Toolkit, copyright (C) 1989, 1990,
- TEGL Systems Corporation. All rights reserved".
-
- Included on the TEGL Windows Toolkit diskettes are a number of support
- files that contain encoded hardware and font information used by the
- standard graphic unit. These files are proprietary to TEGL. You may use
- these files with the programs you create with the TEGL Windows Toolkit for
- your own personal or business use. To the extent the programs you write
- and compile using the TEGL Windows Toolkit make use of these support files,
- you may distribute in combination with such programs, provided you do not
- use, give away, or sell these support files separately, and all copies of
- your programs bear a copyright notice.
-
- The Complete Games Toolkit diskettes provide a demonstration on how to use
- the various features of the TEGL Windows Toolkit. They are intended for
- educational purposes only. TEGL grants you the right to edit or modify
- these game programs for your own use but you may not give away, sell,
- repackage, loan, or redistribute them as part of any program, in executable
- object or source code form. You may, however, incorporate miscellaneous
- sample program routines into your programs, as long as the resulting
- programs do no substantially duplicate all or part of a game program in
- appearance or functionality and all copies of all such programs bear a
- copyright notice.
-
- Limited Warranty:
-
- With respect to the physical diskette and physical documentation enclosed
- herein TEGL warrants same to be free of defects and materials and
- workmanship for a period of one year from the date of purchase.
-
- TEGL will replace defective Software or documentation upon notice within
-
-
-
-
-
-
-
- the warranty period of defects. Remedy for breach of this warranty shall
- be limited to replacement and shall not encompass any other damages,
- including, without limitation, loss or business profits, business
- interruption, pecuniary loss, and special incidental, consequential, or
- other similar claims. This limited warranty is void if failure of the
- Software has resulted from accident, abuse, or misapplication. Any
- replacement Software will be warranted for the remainder of the original
- warrantly period.
-
- TEGL specifically disclaims all other warranties, express, implied, or
- statutory, including but not limited to implied warranties of
- merchantability and fitness for a particular purpose with respect to the
- Software and documentation. In no event shall TEGL be liable for any loss
- of business profit or any other commercial damage including but not limited
- to special, incidental, consequential, or other damages.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Table of Contents
-
- TABLE OF CONTENTS
- SPECIAL NOTE for documentation on disk..................... 13
- Acknowledgements........................................... 14
- Chapter 1 - Introduction................................... 15
- Programming with TEGL Windows Toolkit.................... 15
- The Components of TEGL Windows Toolkit................... 15
- What's On your disks..................................... 16
- Installing TEGL Windows on your system................... 18
- Development System Requirements.......................... 18
- Compiling with Turbo Pascal.............................. 18
- Compiling with Quick Pascal.............................. 18
- How to use this Reference Manual......................... 18
- TEGLSupervisor Procedure.............................. 19
- Program Framework........................................ 19
- Frames or Windows?....................................... 21
- How to Contact TEGL Systems Corporation.................. 21
- Chapter 2 - TEGL Easy...................................... 22
- What TEGL Windows Toolkit can do......................... 22
- Event-Driven Code........................................ 22
- Attaching your Function to an Event...................... 23
- Frames................................................... 24
- Menus.................................................... 24
- A Minimum TEGL Program................................... 25
- Adding Menus (Top Down Design)........................... 25
- Adding your First Event.................................. 27
- TEGLEasy................................................. 29
- ActiveButton Procedure................................ 29
- ColToX Function....................................... 30
- ErrMess Procedure..................................... 30
- FitFrame Procedure.................................... 31
- FrameFromIcon Procedure............................... 31
- FrameText Procedure................................... 32
- GetMousey Function.................................... 32
- GetYesNo Function..................................... 33
- EasyTEGL Procedure.................................... 33
- LastCol Function...................................... 34
- LastRow Function...................................... 34
- OutFrameTextXY Procedure.............................. 34
- Quit Event............................................ 35
- QuickFrame Procedure.................................. 35
- RestoreFont Procedure................................. 36
- RowToY Function....................................... 36
- SelectEasyFont Procedure.............................. 37
- SetEasyFont Procedure................................. 37
- Chapter 3 - Icons.......................................... 38
- The ICON Editor.......................................... 38
- The Main Bar Menu..................................... 38
- Editing............................................... 38
- The Drawing Bar Menu.................................. 38
- ICON Constants........................................... 41
- Putpict Procedure..................................... 41
- ICON Assembler Procedures................................ 42
-
- Programmer's Reference Guide - 4 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- ICON Utilities........................................... 42
- ICONDEF............................................... 42
- ICONLIB............................................... 43
- ICONINC............................................... 43
- ICONASM............................................... 43
- ICONS in TEGLIcon Unit................................... 44
- Chapter 4 - Frames......................................... 45
- Creating, Manipulating, and Dropping Frames.............. 45
- CountFrames Function.................................. 45
- FrameExist Function................................... 45
- PushImage Procedure................................... 46
- PopImage Procedure.................................... 47
- RotateStackImage Procedure............................ 47
- RotateUnderStackImage Procedure....................... 48
- DropStackImage Procedure.............................. 49
- HideImage Procedure................................... 50
- ShowImage Procedure................................... 51
- ShowCoordinates Event................................. 52
- Preparing a Frame for Update............................. 52
- PrepareForPartialUpdate Procedure..................... 52
- PrepareForUpdate Function............................. 53
- CommitUpdate Procedure................................ 54
- Moving a Frame........................................... 55
- FrameSelectAndMove Function........................... 55
- SetAutoRotate Procedure............................... 56
- SetMoveRestrictions Procedure......................... 57
- SetFrameMobility Procedure............................ 57
- SetMoveFrameCallProc Procedure........................ 58
- MoveStackImage Procedure.............................. 59
- MoveFrame Procedure................................... 60
- Low Level Frame Functions................................ 60
- UnLinkFS Procedure.................................... 60
- LinkFS Procedure...................................... 61
- LinkUnderFS Procedure................................. 62
- CreateImageBuffer Procedure........................... 63
- DropImageBuffer Procedure............................. 64
- GetFSImage Function................................... 65
- PutFSImage Procedure.................................. 66
- FreeImageBuffer Procedure............................. 67
- GetPartialFrontImage Function......................... 67
- GetFrontImage Function................................ 68
- PageInFS Procedure.................................... 68
- LockImage Procedure................................... 69
- PageOutFS Procedure................................... 70
- SetImageCoordinates Procedure......................... 70
- PageOutImageStack Function............................ 71
- UnLockImage Procedure................................. 71
- UnUseImage Procedure.................................. 72
- UseImage Procedure.................................... 72
- Mouse Click Areas........................................ 73
- DefineMouseClickArea Procedure........................ 73
- FindMouseClickPtr Function............................ 75
-
- Programmer's Reference Guide - 5 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- ResetMSClickActive Procedure.......................... 77
- ResetMSClickCallProc Procedure........................ 79
- ResetMouseClicks Procedure............................ 80
- ResetMSClickSense Procedure........................... 81
- Keyboard................................................. 83
- ClearKeyBoardBuf Procedure............................ 83
- ClearTEGLKeyBoardBuf Procedure........................ 83
- DefineGlobalKeyClickArea Procedure.................... 83
- DefineLocalKeyClickArea Procedure..................... 84
- DropKeyClick Procedure................................ 85
- FindKeyClickPtr Function.............................. 85
- ResetKeyClickCallProc Procedure....................... 85
- Chapter 5 - Menus.......................................... 87
- Creating a Menu.......................................... 87
- Creating a entry text list............................... 87
- CreateOptionMenu Function............................. 89
- DefineOptions Procedure............................... 90
- CreateShadowOM Function............................... 91
- ResizeOptionMenu Procedure............................ 92
- ToggleCheckMark Procedure............................. 93
- ToggleEntryStatus Procedure........................... 93
- ReplaceOptionText Procedure........................... 94
- ToggleOptionBar Procedure............................. 95
- SetOptionMenuColors Procedure......................... 96
- SetOptionMenuBorderColor Procedure.................... 96
- SetHideSubMenu Procedure.............................. 97
- Creating a Bar Menu...................................... 97
- CreateBarMenu Procedure............................... 98
- OutBarOption Procedure................................ 98
- SetBarTextColor Procedure............................. 99
- SetBarMenuColor Procedure............................. 99
- SetBarBorderColor Procedure...........................100
- SetBarBorderOff Procedure.............................100
- SetBarShadowtext Procedure............................101
- SetBarFillStyle Procedure.............................101
- SetBarMenuMargin Procedure............................102
- Icon Option Menus........................................102
- DefineOptionClickArea Procedure.......................102
- ResetOptionMenuEvents Procedure.......................103
- Chapter 6 - Mouse, Keyboard and Timer Handlers.............105
- Interrupts...............................................105
- SwapTEGLIntrOff Procedure.............................105
- SwapTEGLIntrOn Procedure..............................106
- Mouse Emulation..........................................106
- MCursorOff Procedure..................................106
- MCursorOn Procedure...................................107
- MSetPos Procedure.....................................107
- Standard Mouse Functions.................................107
- ShowMouse Procedure...................................108
- HideMouse Procedure...................................108
- SetMousePosition Procedure............................108
- CursorShape Procedure.................................109
-
- Programmer's Reference Guide - 6 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- SetMouseHotSpot Procedure.............................110
- SetMouseColor Procedure...............................111
- MousePosition function................................111
- GetButtonReleaseInfo Procedure........................112
- GetButtonPressInfo Procedure..........................112
- ClearButtonInfo Procedure.............................113
- SetMouseMinMax Procedure..............................113
- FrozenMouse Procedure.................................114
- FreezeMouse function..................................114
- UnFreezeMouse Procedure...............................115
- SetMouseSensitivity Procedure.........................116
- GetMouseSensitivity Procedure.........................116
- SetKeyBoardMouse Procedure............................117
- SetKBSteps Procedure..................................117
- GetKBSteps Procedure..................................118
- Timer Functions..........................................118
- SwapTimerOut Procedure................................119
- SwapTimerIn Procedure.................................119
- SetTimerStart Procedure...............................119
- ResetTimerFlag Procedure..............................120
- DropTimerCount Procedure..............................120
- TimerSwtich Procedure.................................121
- Keyboard Interrupt Events................................121
- Keyboard Scan Codes......................................122
- AddCaptureKey Procedure...............................122
- DeleteCaptureKey Procedure............................123
- TEGLReadkey Function..................................123
- TEGLKeyPressed Function...............................124
- NilKeyCallProc Function...............................124
- Keyboard Miscellaneous...................................125
- SetShiftKeys Procedure................................125
- Show Button Status.......................................125
- ShowButtonStatus Event................................125
- Chapter 7 - Assembly Language Graphics.....................127
- Setting Video Modes......................................127
- CGA640x200x2 Procedure................................128
- EGA640x350x16 Procedure...............................128
- Herc720x200x2 Procedure...............................128
- SetVideoChoices.......................................129
- SVGA800x600x16........................................129
- VGA640x480x16 Procedure...............................129
- VideoAutoDetect.......................................130
- VideoID...............................................130
- Graphic Primitives.......................................131
- FastLine Procedure....................................131
- Putpixs Procedure.....................................132
- Getpixs Function......................................132
- Getbiti Procedure.....................................133
- Putbiti Procedure.....................................133
- BigImageSize Function.................................134
- SetAPage Procedure....................................134
- SetVPage Procedure....................................135
-
- Programmer's Reference Guide - 7 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- FlipAPage Procedure...................................135
- FlipVPage Procedure...................................136
- VideoPage Function....................................136
- New Graphic Primitives...................................137
- Extractpixs Function..................................137
- ExtractIMG Procedure..................................137
- OverlayIMG Procedure..................................138
- SwapBytes Procedure...................................138
- Graphic Derivatives......................................138
- XORCornerBox Procedure................................139
- XORBox Procedure......................................139
- Icon Graphics............................................139
- Putpict Procedure.....................................139
- PictSize Procedure....................................140
- Abort Procedure.......................................140
- Chapter 8 - Special Effects................................142
- Screen Backdrop..........................................142
- ClearTEGLScreen Procedure.............................142
- SetTEGLBorderShow Procedure...........................143
- SetTEGLBackColor Procedure............................143
- SetTEGLBorderColor Procedure..........................144
- SetTEGLFillPattern Procedure..........................145
- SetTEGLFillStyle Procedure............................145
- Creating Shadow Boxes....................................146
- ShadowBox Procedure...................................146
- ShadowBoxText Procedure...............................147
- SetShadowColor Procedure..............................147
- SetShadowBorderColor Procedure........................148
- SetShadowFillPattern Procedure........................148
- SetShadowFillStyle Procedure..........................149
- Creating Shadow Text.....................................150
- Shadowtext Procedure..................................150
- SetShadowTextType Procedure...........................150
- SetShadowTextShadow Procedure.........................151
- SetShadowTextHighlight Procedure......................152
- ShadowTextHighlightOFF Procedure......................152
- Other text effects.......................................153
- ExtendTextXY Procedure................................153
- ShiftTextXY Procedure.................................153
- Buttons..................................................154
- DefineButtonClick Procedure...........................154
- DefineLongButtonClick Procedure.......................154
- DefineUserButtonClick Procedure.......................155
- PutUserButtonClick Procedure..........................155
- Explosions...............................................156
- CollapseToIconShow Event..............................156
- CollapseToMsClick Event...............................156
- ExplodeFromIconHide...................................157
- ExplodeFromMsClick Procedure..........................157
- Moving and Transforming XOR Boxes........................158
- MoveBox Procedure.....................................158
- ZipToBox Procedure....................................159
-
- Programmer's Reference Guide - 8 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- ZipFromBox Procedure..................................159
- Icon Button..............................................160
- DrawLongButton Procedure..............................160
- Chapter 9 - Writing Events.................................162
- Mouse Awareness..........................................162
- FindFrame Function....................................162
- CheckMouseClickPos Function...........................164
- CheckForMouseSelect Function..........................165
- Special Effects..........................................167
- PressButton Procedure.................................167
- VisualButtonPress Function............................169
- Chapter 10 - Animation.....................................171
- Animation Overview.......................................172
- Animation OOPS Methods...................................174
- Origin Procedure Method...............................174
- GetOrigin Procedure Method............................175
- Destination Function Method...........................175
- ResetFrame Procedure Method...........................176
- Sequence Procedure Method.............................177
- ResetSequence Procedure Method........................177
- AddFrame Procedure Method.............................178
- CurrentFrameNumber Function Method....................179
- AnimateInit Procedure Method..........................179
- Animate Procedure Method..............................180
- Complete Procedure Method.............................180
- Example Animation........................................180
- Chapter 11 - Writing Text..................................183
- TEGLWrt Variables........................................183
- Bit-mapped Fonts.........................................183
- Creating Your Own Bit-mapped Fonts.......................183
- TEGLWrt Functions and Procedures.........................183
- OutTEGLTextXY Procedure...............................184
- TEGLTextWidth Function................................184
- TEGLCharWidth Function................................185
- TEGLCharHeight Function...............................185
- TEGLWrtChar Procedure.................................186
- SetProportional Procedure.............................186
- SetTEGLFont Procedure.................................186
- UnderLineChar Function................................187
- Showing ALL Fonts FONTTEST.PAS...........................187
- FontName Function.....................................187
- ShowOneFont Event.....................................188
- ShowFonts Event.......................................188
- Chapter 12 - Event Library.................................189
- The File Selector........................................189
- SelectaFile function..................................189
- String Editing Dialog....................................191
- EditString Procedure..................................191
- Mouse Sensitivity Dialogue Window........................191
- SetMouseSense Procedure...............................192
- Bells & Whistles, Sound Unit.............................192
- AskSoundSense Event...................................192
-
- Programmer's Reference Guide - 9 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- Beep Procedure........................................193
- SlideBeep Procedure...................................193
- SoundSwitch Procedure.................................194
- Chapter 13 - Virtual Memory Manager........................195
- Heap Management..........................................195
- The Turbo Pascal Heap Manager............................195
- The TEGL Heap Manager....................................196
- The TEGL Heap Error Function.............................196
- The TEGL Heap Manager Functions..........................197
- TEGLGetMem Procedure..................................197
- TEGLFreeMem Procedure.................................198
- Expanded Memory Manager (EMM)............................198
- Expanded Memory Functions................................199
- EmmInstalled function.................................199
- EMSPagesAvailable function............................200
- AllocateExpandedMemoryPages function..................200
- MapExpandedMemoryPages function.......................201
- GetPageFrameBaseAddress function......................201
- DeallocateExpandedMemoryPages function................202
- GetVersionNumber function.............................202
- GetHandleCountUsed function...........................203
- GetPagesOwnedByHandle function........................203
- Expanded Memory Test Program.............................204
- A RAM Disk Driver........................................207
- EMSOpen function......................................207
- EMSSeek procedure.....................................208
- EMSBlockWrite procedure...............................209
- EMSBlockRead procedure................................209
- EMSClose procedure....................................210
- Virtual Disk Heap........................................211
- VDskOpenHeapFile function.............................211
- VEMSOpenHeapFile function.............................212
- VDSKGetMem function...................................213
- VDSKFreeMem procedure.................................214
- VDSKWriteHeapData procedure...........................214
- VDSKReadHeapData procedure............................215
- VDskCloseHeapFile procedure...........................215
- The Virtual Heap Error Function..........................216
- The Virtual Memory Manager...............................216
- UseHardDisk procedure.................................217
- MoveFromVirtual procedure.............................217
- MoveToVirtual function................................218
- FreeVirtual procedure.................................218
- CloseVirtual procedure................................219
- TEGLMaxAvail Function.................................219
- VirtualMemUsed Function...............................219
- The Virtual Memory Error Function........................220
- Resolving Fragments......................................220
- ReserveHugeMinimum procedure..........................221
- Sizing and Sliders.........................................223
- DefineResizeClickArea Procedure.......................223
- DefineResizeMinMax Procedure..........................224
-
- Programmer's Reference Guide - 10 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- DefineSliderArea Procedure............................224
- DropSliders Procedure.................................225
- FindSliderFS Function.................................225
- ResizeFrame Procedure.................................226
- SelectAndMoveFrame Event..............................226
- SetSlidePosition Procedure............................227
- Miscellaneous Functions....................................228
- CheckCtrlBreak Procedure..............................228
- CheckCtrlBreakFS Procedure............................228
- DropTimerTick Procedure...............................229
- NilUnitProc Event.....................................229
- OverLapArea Function..................................230
- SetTimerTick Procedure................................230
- TGraph.....................................................231
- Bar Procedure.........................................232
- CloseGraph Procedure..................................232
- DetectGraph Procedure.................................233
- GetBkColor Function...................................233
- GetColor Function.....................................233
- GetFillPattern Procedure..............................234
- GetGraphMode Function.................................234
- GetMaxX Function......................................235
- GetMaxY Function......................................235
- GetTextSettings Procedure.............................235
- ImageSize Function \ TGraph...........................236
- GraphResult Function..................................236
- InitGraph Procedure...................................236
- Line Procedure........................................237
- OutTextXY Procedure...................................237
- Rectangle Procedure...................................238
- RestoreCrtMode Procedure \ TGraph.....................238
- SetBkColor Procedure..................................238
- SetColor Procedure....................................239
- SetFillPattern Procedure..............................239
- SetFillStyle Procedure................................239
- SetTextJustify Procedure..............................240
- APPENDICES.................................................241
- Video Buffers............................................241
- Windows..................................................241
- Frames...................................................241
- A Frame Stack............................................242
- A Simple Window Manager..................................242
- Partial Image Update.....................................244
- Refined Partial Image Update.............................244
- A Refined Partial Image Update Algorithm.................245
- A Quick Run through the algorithm........................246
- Turbo Pascal Heap Manager................................248
- TEGL Heap Manager........................................252
- Combining the best of both Heap Managers (Coexisting)....255
- Variables, Types and Const...............................257
- ActivePage Word Typed Const...........................257
- CallProc Procedure Type...............................257
-
- Programmer's Reference Guide - 11 - TEGL Windows Toolkit
-
-
-
-
-
- Table of Contents
-
- FG* Const.............................................257
- Jagged Word Typed Const...............................257
- MSClick Boolean Const.................................258
- MSSense Boolean Const.................................258
- RmwBits Word Typed Const..............................258
- Conditional Compilation..................................258
- INDEX......................................................261
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 12 - TEGL Windows Toolkit
-
-
-
-
-
-
-
- SPECIAL NOTE for documentation on disk
-
- You have received Version II of the TEGL Windows Toolkit. The
- documentation that you are reading is supplied on disk. We will have a
- printed manual in the near future and it will be somewhat different that
- what you are looking at now.
-
- Because we wanted everyone to be able to read this manual and be able to
- print it out we have not embedded any special control characters in it
- with the exception of formfeeds at page breaks.
-
- In this manual you will notice that at times there are references to
- things like ctrlkey or keydown or something discriptive but somewhat odd.
- Please, be imaginative, these will be icons when the manual is printed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 13 - TEGL Windows Toolkit
-
-
-
-
-
- Acknowledgements
-
- Acknowledgements
- ___________________________________________________________________________
-
- In this manual references are made to several products
-
-
- IBM is a registered trademarks of International Business
- Machines Inc.
-
- MS-DOS and Windows are registered trademarks of Microsoft
- Inc.
-
- MacIntosh is a registered trademark of Apple Computer Inc.
-
- Turbo Pascal is a registered trademake of Borland International.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 14 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
-
- INTRODUCTION
- ___________________________________________________________________________
-
- Welcome to the world of the Graphic User Interface (GUI) in a DOS
- environment. This book, The programmers reference guide to TEGL
- Windows Toolkit II, will provide you with the basics (and more) for
- getting started with using the TEGL Windows Toolkit.
-
- TEGL Windows is a comprehensive GUI toolkit for the simplest to the most
- complex system programming projects. In order to exploit all the
- advantages of this toolkit, we encourage you to experiment and to try the
- examples as listed in this manual.
-
- Programming with TEGL Windows Toolkit
-
- TEGL Windows Toolkit provides the framework to make programs easy to use.
- If you are new to programming you will find the Toolkit fun and fast to
- use. Experienced programmers will find their development time reduced by
- using the Toolkit.
-
- TEGL Windows Toolkit provides graphics that can communicate information
- more effectively than text. For example, the graphical image of a folder
- suggests that it contains documents, drawings, and even other folders.
-
- TEGL Windows Toolkit also Provides functions that can build interactive
- applications. Interactive means a type of user interface where a
- significant portion of the design and development effort goes into making
- the program user friendly.
-
- TEGL Windows Toolkit is based on event handling. Events are such things as
- a key being pressed on the keyboard; a timer signaling that some amount of
- time has elapsed; a message indicating that the user has selected a
- particular item from the menu or has selected an icon. A particularly
- useful capability of this is that while the TEGLSupervisor is waiting
- for one of these events to occur, you can set the timer to signal a
- background task such as an internal print spooler. This limited
- multitasking capability makes it easier to build very interactive
- programs.
-
- TEGL Windows Toolkit supports only a single application running at any
- given time. The necessary code is linked into the final application code.
- TEGL Windows Toolkit uses little RAM, requiring only 50k of the executable
- program when all features are used.
-
- The Components of TEGL Windows Toolkit
-
- Now that you have a rough idea of what the TEGL Windows Toolkit is,
- let's explore the components in more detail. The purpose of this section
- is to give you an overall understanding of how to use the toolkit in your
- program.
-
-
- Programmer's Reference Guide - 15 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- TEGL Windows Toolkit is subdivided into a set of libraries: multitasking
- kernel; windowing screen manager; mouse, keyboard and timer handler; a
- virtual heap manager; drop down and pop-up menu events; and an animation
- unit.
-
- TEGL Windows Toolkit provides a GUI to a computer running under DOS. This
- interface is used in a number of entertainment products produced by TEGL
- Systems Corporation (TSC). As TSC designed and built the entertainment
- products, TEGL was created to build a set of software routines that were
- needed by the games. TSC gathered these routines into modules, each
- categorized by their overall function. For instance, all the routines that
- manipulate windows form the TEGLUnit. Similarly, all the drop-down menus
- and menu bars form TEGLMenu.
-
- TEGL Windows Toolkit comprises the tools that were developed in writing
- the first TSC applications. These tools are now available for developing
- any application.
-
- The modules are categorized by the kind of functions they deliver;
- TEGLintr handles the mouse, keyboard and timer interrupts; TEGLMenu
- provides drop down menus and menu bars; Animate provides icon animation;
- and VIRTMem provides the virtual heap for almost unlimited windowing
- ability.
-
- TEGLUnit provides a high level integration between window frames,
- mouse click areas, keyboard handler, timer interrupts, virtual memory, and
- multitasking kernel.
-
- What's On your disks
- The distribution disks that come with this manual include the complete
- library of routines used by some of the game products produced by TEGL
- Systems Corporation.
-
- For your reference, here's a summary of most of the files on disks:
-
- README
- This file contains any last-minute notes and
- corrections, type README at the system prompt to
- view the file. You may print this file on your printer
- for future reference once you review the material.
- TEGLUNIT.PAS
- This is the window manager that provides the graphical
- interface support for the other units. This module
- provides the event supervisor and the frame/stack
- coordinator.
- TEGLMENU.PAS
- This unit provides the drop down menu interface.
- TEGLGRPH.PAS
- This unit provides shadow boxes, shadow texts,
- exploding and imploding boxes, pop-down/pop-up icon
- buttons, etc..
- TEGLICON.PAS
-
- Programmer's Reference Guide - 16 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- A library of standard icons; key OK, key CANCEL,
- key NEXT, key LAST.
- TEGLINTR.PAS, TEGLINTR.ASM
- Integration of keyboard and mouse handler. This unit
- provides the standard mouse routines which integrates
- the keyboard cursor keys and the mouse to provide a
- seamless dual control of the mouse cursor; with or
- without a mouse driver.
- FASTGRPH.PAS *.ASM
- Fast assembly language graphics routines. This is the
- core of the graphical routines that provide the
- foundation for pop-down menus and movable windows.
- This unit includes functions that interfaces with the
- FASTGRPH and the ANIMATE unit, to allow the recognition
- of video paging.
- TEGLFONT.PAS FNT*.pas
- Crisp proportional Bit-Mapped screen fonts, ranging
- from 6 to 24 pixels in height.
- VIRTMEM.PAS
- Virtual memory handler that interfaces with TEGLUNIT.
- This unit automatically pages out images from memory to
- EMS, hard disk, or floppy (depending on availability),
- when memory is at a premium. Also implements the far
- heap for allocating data structures larger than 64K.
- SELECTFL.PAS
- A standard event unit that may be used by any
- application program to provide a dialogue window in
- selecting file names from a list of file on disk.
- SENSEMS.PAS
- A standard event unit that provides a dialogue window
- that allows a user to adjust the sensitivity of a
- mouse.
- SOUNDUNT.PAS
- A standard event unit that allows a user to adjust the
- duration and the sound output of a tone.
- SWITCHES.INC
- Conditional compilaton directive are contained in this
- file.
- ANIMATE.PAS
- A unit that allows icons to be animated.
- TEGL.PAS
- A demonstration program that uses many of the features
- of the TEGL Windows Toolkit.
- FONTTEST.PAS
- A demonstration event unit that displays all available
- fonts in movable windows. Used in tegl.pas (sample
- program).
- DEBUGUNT.PAS
- A demonstration event unit that displays general
- information regarding windows and the number of times
- the mouse button has been pressed.
- SAM*.PAS
-
- Programmer's Reference Guide - 17 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- Some of the sample programs in this guide are provided
- in ready-to-compile form.
- EXECSWAP.PAS
- A utility unit that swaps a pascal program from memory
- to enable another program to execute. This unit makes
- it practical to execute a DOS shell with programs that
- are using all of memory.
-
-
- Installing TEGL Windows on your system
- The complete TEGL Toolkit is approximately 3 megabytes of source code
- when expanded. Therefore, a hard disk is required for the installation.
-
- At the DOS prompt, type INSTALL, and follow the instructions.
-
- Development System Requirements
- You must have 640k RAM, a hard disk drive, and an EGA/VGA (256K), CGA, or
- Hercules graphics card and appropriate monitor on an IBM PC or compatible
- computer. In our development, we've used an IBM PC AT with 2.5MB RAM, 72MB
- hard disk, and a paradise VGA 256k card with a NEC/MultiSync 3D. We've
- also tested all our examples on an IBM PC XT with 640k RAM, a 20MB hard
- disk, and a ATI VIP VGA graphics adapter card with an IBM 8513 VGA color
- monitor.
-
- Compiling with Turbo Pascal
-
- TEGL Windows Toolkit requires Borland's Turbo Pascal Version 5.0, as a
- minimum, to compile the units. The Animate unit requires the object
- oriented programming facilities provided by Version 5.5.
-
- Refer to the Turbo Pascal Reference Manual for including and using units
- within programs, as well as setting up the environment for referencing the
- units.
-
- Compiling with Quick Pascal
-
- TEGL Windows works with Microsoft Quick Pascal Version 1.0.
-
- Quick Pascal's integrated environment cannot be used to compile
- applications using the Toolkit. It runs out of memory. The command-line
- compiler must be used.
-
- If you intend to use the MSGraph unit then you must define the symbol
- Quick in the file switches.inc. See the appendix Conditional
- Compilation for furthur information.
-
- How to use this Reference Manual
-
- This manual is organized in a presentation manner to lead you through the
- concepts of the TEGL Windows Toolkit II.
-
- Each Procedure and Function is shown seperately with its name, parameter
-
- Programmer's Reference Guide - 18 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- list, the unit it is declared in, and other references. For a start here is
- the main entry point into the TEGL Windows Toolkit II.
-
-
- ___________________________________________________________________________
-
- TEGLSupervisor Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Main entry point.
- Declaration
- TEGLSupervisor;
- Remarks
- This should be the last statement in your main program
- block.
- Example
-
-
- BEGIN
- { -- all the setup code for menus etc. goes first }
- TEGLSupervisor;
- END.
-
-
-
-
- Program Framework
-
- Most of the examples presented throughout this manual will require the following
- minimal skeletal Pascal framework before the example code will compile and
- execute. A few of the examples given are complete programs.
-
-
-
-
-
- { samshell.pas }
- {$F+} { -- far code model is required for any functions that }
- { -- are to be used as Event Handlers }
-
- Uses
- dos,
- graph,
-
- virtmem,
- fastgrph,
- TEGLIntr,
- TEGLICON,
- TEGLGRPH,
-
- Programmer's Reference Guide - 19 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- TEGLUnit,
- TEGLMenu,
- TEGLEasy
- SenseMs,
- DebugUnt;
-
-
- { -- insert variables here }
-
-
- { -- insert procedures and functions here }
-
-
-
- BEGIN
- EasyTEGL;
-
- { -- insert the example code here }
- { -- press Ctrl-Break to exit program }
-
-
- { -- control is then passed to the supervisor }
-
- TEGLSupervisor;
- END.
-
-
-
-
- Once control has been turned over to the supervisor then the only way to
- exit a program is by a menu selection or icon that halts the program. Most
- of the example programs don't have this so you must press Ctrl-Break to
- exit. When Ctrl-Break is pressed then program control is turned over to
- an Event Handler. In the case of the sample programs control is passed to
- Quit in TEGLEasy.
-
- An Event Handler, as covered in Chapter 4, is usually attached to an icon,
- menu selection, or in this case the Ctrl-Break handler. The Ctrl-Break
- handler, when attached to an exit event, allows the program to exit
- gracefully by pressing ctrlkeyscrlock which is the break key on
- most keyboards.
-
- Chapter 2 provides a foundation to using the TEGL Windows Toolkit by using
- a few program examples. Chapter 3 shows you how to create an icon using
- the icon editor, and how to integrate and use the icons in your program.
- Chapter 4 is heart of the windowing system, which uses most of the other
- functions provided by the other units. In Chapter 5 we delve further into
- how the TEGLMenu works along with TEGLUnit to provide the
- standard drop-down menus and exploding windows. In Chapters 6 through 8,
- we discuss some of the graphic and mouse primitives that the TEGLUnit
- uses. You may use some of these routines independently of TEGL. In Chapter
- 10 we explore the Animation unit along with a sample application that
-
- Programmer's Reference Guide - 20 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 1 - Introduction
-
- animates a button icon. Chapter 11 looks at writing text to a window using
- bit-mapped fonts. Finally, in Chapter 12, we look at the Virtual Memory
- handler and how to use VM within an application. The Appendices provide
- greater details on the TEGL Windows Toolkit and the philosophy behind the
- design.
-
- Frames or Windows?
-
- In this manual the word frame is used often. A frame is our term for
- the implementation of a window. All the identifiers in the toolkit use
- frame, not window. You can use these terms interchangeably.
-
- How to Contact TEGL Systems Corporation
- If you have any comments or suggestions, you may contact us by
- writing to
-
- TEGL Systems Corporation
- 780 - 789 West Pender Street
- Vancouver, British Columbia
- Canada, V6C 1H2
-
- or phone us at
-
- (604) 669-2577
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 21 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- TEGL Easy
- ___________________________________________________________________________
-
- The TEGL Windows Toolkit provides tools to assist you in creating an
- eye-appealing, functional and intuitive graphical interface to your
- programs.
-
- There is no fixed format that you must follow when using the TEGL Windows
- Toolkit. Screen handling, menus, or push button icons are a function of
- your program design and not a mandatory function of the TEGL Windows
- Toolkit. However, the tools are provided so you can use emulate the
- look and feel of most popular windowing packages without locking you
- into a ridged menu system.
-
- What TEGL Windows Toolkit can do
-
- Overlapping windows are handled without having the application program
- redraw the window whenever that window is uncovered. This removes the
- complexity of having to redraw, which is necessary with some windowing
- systems. The only time a window has to be redrawn is when it is re-sized.
-
- The overhead in maintaining graphic images in memory is offset by the virtual
- memory manager which automatically swaps the images to EMS and/or disk when
- more memory is needed. Even with memory swapping, application programs are
- faster and smaller than those written for other windowing environments.
-
- TEGL handles all mouse and keyboard activities, including all selections
- of a menu items and clicks on a mouse click area. When the user wants to
- move a window for instance, the TEGLSupervisor handles all of the
- user interaction from the clicks of the right mouse button on a window to
- when the button is released to indicate the new position. When the button
- is released, and MoveFrameCallProc has been installed for that window,
- the TEGLSupervisor will call your application procedure with the new
- location. Your application can either move the frame by calling
- MoveStackImage or not do so, depending on whatever it determines is
- appropriate.
-
-
- Event-Driven Code
-
- While it is possible to write your application in a serial manner using
- TEGL Windows by polling the keyboard to see if a key has been pressed, or
- checking the mouse if the mouse has been clicked on an icon or menu, it is
- much more efficient to write using Event-Driven programming.
- Event-driven programming is a style of building programs that makes for
- extremely interactive applications.
-
- An event is simply the automatic calling of one of your application's
- procedures that is triggered by an action such as the mouse cursor
- overlapping with an icon on the screen. This type of event handling
- removes the complex checking of keyboards and mouse devices from the
- central program and allows for an almost parallel (multitasking) type of
-
- Programmer's Reference Guide - 22 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- program to be created.
-
- Your choice in programming will determine whether your program responds to
- the user in a sequential mode where one action must be completed before
- proceeding to the next, or multiple activities that may be completed at
- the user's leisure.
-
- A good example of multiple event handling is a program that simulates a
- calculator. Each key of the calculator pad is tied together with a
- Mouse Click Area event-handler (ie. a pascal function) that handles that
- particular key. With the selection of one of the numeric icon keys, the
- supervisor activates the appropriate event-handler which either adds,
- multiplies, subtracts, or divides the digits. On completion of the
- event-handler's task, the control is returned back to the supervisor to
- await for other events. Other event-handlers, such as notepads, will
- continue to respond to keyboard or mouse actions along with the activities
- on the calculator.
-
- An Event is a powerful concept. Hypertext on the MacIntosh is based on a
- similar structure. By associating an event with a word, image, or icon,
- you can chain a series of events together. One event may lead to another?
-
- The number of icon/events that can be created is limited only by available
- memory.
-
-
- Attaching your Function to an Event
-
- There are six (6) basic types of events that the TEGLSupervisor
- recognizes. The following will provide a brief discussion on event
- handling.
-
-
- {bo Mouse Click Area}
-
- This event occurs whenever the mouse cursor overlaps a defined mouse click
- area on the screen. Depending on the activation sense, the supervisor may
- call the event-handler only if the left button is clicked (activation
- sense set to MsClick), or if the mouse cursor passes over the defined
- mouse click area (activation sense set to MsSense). The most common use of
- a mouse click area is the association of an icon with an event-handler.
-
- {bo Click and Drag}
-
- This event is associated with the movement of a window. Control is passed
- to the Event-handler after a new frame position has been selected. One use
- of this type of event processing is the dragging of an icon-frame to the
- trash can (like the MacIntosh).
-
- {bo Expand and Shrink}
-
- This event is associated with the sizing of a window. Control is passed to
-
- Programmer's Reference Guide - 23 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- the Event-handler after a new frame size has been selected. We use this
- type of event to re-size a window.
-
- {bo Keyboard Events}
-
- To accommodate systems without a mouse. The Keyboard Event allows you to
- tie the keyboard to any normal mouse-click-area event handler.
-
- {bo Timer Ticks}
-
- The PC has an internal timer that interrupts the activities of any running
- program 18 times a second. This interruption is transparent to the
- operating system and is used mainly to update the system clock.
-
- The TEGL unit uses this timer to provide a flag for the interval of timed
- events. An event-handler may be defined to occur at resolutions up to 18
- times a second or several hours later.
-
- {bo Ctrl-Break}
-
- The Ctrl-Break event is usually tied with the event-handler QUIT, but,
- like any Event, you may write your own to perform a a different task when
- a Ctrl-Break event occurs.
-
-
-
- Frames
-
- TEGL is a window manager or more correctly a FRAME STACK coordinator. A
- frame is any defined region of the screen. By stacking two or more frames
- on the screen, the supervisor monitors the location of the frames and
- ensures that each frame retains it's own entity.
-
- Once a frame is created, the frame area can be cleared and drawn with any
- graphic functions provided by the Turbo Pascal language or any other
- graphical functions provided by other library packages. However, the
- responsibility of drawing within the window is with the program.
-
- Use the x, y, x1, y1 coordinates provided within the frame record
- when drawing to the window.
-
- Menus
-
- The TEGL Menus are actually event-handlers that have been written to
- accommodate drop-down menus, menu selections, lists within a frame, etc.
-
- The menus require a list of items and related events to be created. The
- list may then be attached to a bar menu using the OutBarOption, which
- is simply a frame with multiple horizontal mouse click defines.
-
- When TEGLSupervisor senses the mouse overlapping with one of the bar
- menu selections, an internal BarOptionMenu event is called and a
-
- Programmer's Reference Guide - 24 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- search is made to find the list that is related to the selection. A menu
- window is then created and displayed using the list. The menu window is
- simply another frame with multiple mouse click defines.
-
-
- A Minimum TEGL Program
-
- The following demo program, prints out the message q Hello World! to a small
- movable window. Note: this one doesn't require the minimum shell that we
- described in the Introduction.
-
-
-
-
-
- { samc0201.pas }
-
- Uses
- dos,
- graph,
- virtmem,
- fastgrph,
- TEGLIntr,
- TEGLWrt,
- TEGLICON,
- TEGLGRPH,
- TEGLUnit,
- TEGLMenu,
- TEGLEasy;
-
-
- BEGIN
- EasyTEGL;
-
- PushImage(100,100,200,120);
- Shadowbox(100,100,200,120);
- setcolor(black);
- OutTEGLTextXY(105,105,'Hello World!');
-
- TEGLSupervisor;
- END.
-
-
-
-
-
-
-
- Adding Menus (Top Down Design)
-
- A powerful feature in programming with TEGL Windows is the ability to
- visually see your application develop. Top down design is a methodology
-
- Programmer's Reference Guide - 25 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- where the layout and menu designs are created first and the functional
- aspect of the program created later. Program stubs are used as place
- markers to indicate the required function.
-
- Adding a drop down menu and connecting the event later is a simple
- task with TEGL Windows.
-
-
-
- { samc0202.pas }
-
-
- VAR
- om1, om2 : OptionMPtr;
-
-
-
- FUNCTION GetMsSense(FS:imagestkptr; Ms: msclickptr) : WORD;
- BEGIN
- SetMouseSense(fs^.x,fs^.y);
- GetMsSense := 1;
- END;
-
-
-
- BEGIN
-
- EasyTEGL;
-
-
- om1 := CreateOptionMenu(@Font14);
- DefineOptions(om1,' Open ',true,NilUnitProc);
- DefineOptions(om1,'--',false,NilUnitProc);
- DefineOptions(om1,' Quit ',true,Quit);
-
- om2 := CreateOptionMenu(@Font14);
- DefineOptions(om2,' Memory ',true,ShowCoordinates);
- DefineOptions(om2,' Mouse Sensitivity ',true,GetMsSense);
-
- CreateBarMenu(0,0,getmaxx);
- OutBarOption(' File ',om1);
- OutBarOption(' Utility ',om2);
-
-
- TEGLSupervisor;
- END.
-
-
-
-
- The events ShowoneFont and ShowFonts are defined in FONTTest,
- ShowCoordinates and ShowButtonStatus are both defined in
-
- Programmer's Reference Guide - 26 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- DebugUnt, AskMouseSense is defined in SenseMS, and Quit
- is defined in TEGLEasy.
-
- ExitOption already exists as a event in the example above.
-
- The rest of the menu selection are all defined to NilUnitProc which
- is a program event stub that does nothing.
-
- Adding events as you go along is easy, now that the menu is set up.
-
- Adding your First Event
-
- The following is an event that opens a window and writes a message.
-
-
-
-
-
-
- { samc0203.pas }
- FUNCTION InfoOption(FS:imagestkptr; Ms: MsClickPtr) : WORD;
- VAR
- x,y,x1,y1 : WORD;
- IFS : ImageStkPtr;
- BEGIN
- Hidemouse;
-
- x := 200;
- y := 120;
- x1 := x+340;
- y1 := y+100;
-
- PushImage(x,y,x1,y1);
- IFS := StackPtr;
-
- SetColor(White);
- ShadowBox(x,y,x1,y1);
- SetColor(Black);
- OutTEGLtextxy(x+5,y+5,'TEGL Windows Toolkit II');
- OutTEGLtextxy(x+5,y+5+TEGLCharHeight,
- 'Jan 1,1990, Program Written by Richard Tom');
-
- ShowMouse;
-
- InfoOption := 1;
- END;
-
-
- Then change the menu declaration line to add InfoOption like so:
-
- DefineOptions(om1,'Info...',TRUE,InfoOption);
-
-
- Programmer's Reference Guide - 27 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
-
-
-
- You may notice that the event returns to the TEGLSupervisor leaving
- the window on the screen.
-
- We can refined this procedure by adding a while loop to wait for the user
- to click on a icon. The CheckforMouseSelect(IFS) will return a
- MouseClickPos once the user has selected the OK icon. While we are
- changing the event, we might as well add in an expanding and shrinking box
- effect.
-
- The new event listing.
-
-
-
-
-
- { samc0204.pas }
- FUNCTION InfoOption(FS:imagestkptr; Ms: msclickptr) : WORD;
- VAR
- x,y,x1,y1 : word;
- ifs : ImageStkPtr;
- ax,ay,ax1,ay1 : word;
- option : word;
- BEGIN
- HideMouse;
-
- x := 200;
- y := 120;
- x1 := x+340;
- y1 := y+100;
-
- ax := Ms^.ms.x+FS^.x;
- ay := Ms^.ms.y+FS^.y;
- ax1 := Ms^.ms.x1+FS^.x;
- ay1 := Ms^.ms.y1+FS^.y;
-
-
- PushImage(x,y,x1,y1);
- IFS := stackptr;
-
- ZipToBox(ax,ay,ax1,ay1,x,y,x1,y1);
-
- SetColor(White);
- ShadowBox(x,y,x1,y1);
-
- SetColor(Black);
- OutTEGLtextxy(x+5,y+5,'TEGL Windows Toolkit II');
- OutTEGLtextxy(x+5,y+5+TEGLCharHeight,
- 'Jan. 1, 1990, Program Written by Richard Tom');
-
- Programmer's Reference Guide - 28 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
- PutPict(x+280,y+75,@ImageOk,Black);
- DefineMouseClickArea(IFS,280,75,280+35,75+12,TRUE,
- NilUnitProc,MSClick);
- SetMousePosition(x+290,y+85);
- ShowMouse;
-
- WHILE CheckforMouseSelect(IFS)=NIL DO;
-
- HideMouse;
- DropStackImage(ifs);
- ZipFromBox(ax,ay,ax1,ay1,ifs^.x,ifs^.y,ifs^.x1,ifs^.y1);
- ShowMouse;
-
- InfoOption := 1;
- END;
-
-
-
-
- TEGLEasy
-
-
-
-
- ___________________________________________________________________________
-
- ActiveButton Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Makes a button/frame.
- Declaration
- ActiveButton(x,y: Word; s : String; P : CallProc);
- Remarks
- This is for creating a button which is attacted to a
- frame that is the same size as the button. P the
- event can then have as the first statement
- FrameFromIcon to make a dramatic button to frame
- transition.
- Restrictions
- If the ImageStkPtr is required then save the
- StackPtr immediately after calling ActiveButton.
- See also
- ExplodeFromIconHide, CollapseToIconShow.
- Example
-
-
- ActiveButton(1,1,'?',HelpEvent);
-
-
-
- Programmer's Reference Guide - 29 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
-
-
- ___________________________________________________________________________
-
- ColToX Function TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Calculates the X coordinate for a text col.
- Declaration
- ColToX(Col : Integer) : Integer;
- Remarks
- This is used to treat the graphics display as if it
- were in text mode to make it easy to place a
- succession of characters.
- Restrictions
- The calculation is made using the currently selected
- font.
- See also
- RowToY, SetTEGLFont, SetEasyFont.
-
-
-
- ___________________________________________________________________________
-
- ErrMess Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Display an error message.
- Declaration
- ErrMess(x,y : Word; s : String);
- Remarks
- The error message s is displayed in a frame at
- coordinates x,y. The frame is sized to the message
- and is moved to keep within the confines of the screen.
-
- The frame is displayed until the 'OK' button in the
- lower right corner is clicked.
- See also
- GetYesNo.
- Example
-
-
- Error(100,100,'You must enter a file name first');
-
-
-
-
-
- Programmer's Reference Guide - 30 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
- ___________________________________________________________________________
-
- FitFrame Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Creates coordinates that fit on the physical screen.
- Declaration
- FitFrame(VAR x,y,width,height: Word);
- Remarks
- x,y are the desired upper left coordinates for a
- frame. Width and Height are the desired width
- and height in pixels for the frame. If the starting
- coordinates would cause the frame to extend beyond the
- bounds of the screen then they are decremented until the
- frame will fit. If width or height are greater
- than their corresponding GetMaxX or GetMaxY then
- they are set to the maximum screen size.
-
- The lower right coordinates are returned in width=x1,
- and height=y1.
- See also
- QuickFrame.
-
-
-
- ___________________________________________________________________________
-
- FrameFromIcon Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Opens a frame in an event that was called from a click
- on a icon.
- Declaration
- FrameFromIcon(ifs: ImageStkPtr; ms: MsClickPtr;
- x,y,x1,y1 : Word);
- Remarks
- This would be the first statement in an event that is
- attached to an icon or button created with active
- button.
-
- This procedure will hide the icon then display an
- exploding wire box from the icon location to the
- coordinates x,y,x1,y1 where a frame is opened and
- cleared. An OK button is placed in the lower right
- corner of the frame and it is attached to
- CollapseToIconShow which will close the frame when
- it is clicked on.
-
- Programmer's Reference Guide - 31 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- See also
- ActiveButton, ExplodeFromIconHide
-
-
-
- ___________________________________________________________________________
-
- FrameText Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Writes text to a frame using row, column coordinates
- simulating text mode.
- Declaration
- FrameText(ifs : ImageStkPtr; Row,Col : Integer;
- s : String);
- Remarks
- ifs is the frame to write to. Row and Col
- are the row and column locations relative to the frame.
- That is, row 1, col 1, is the upper left corner of the
- frame. Note the coordinates are the reverse of graphics
- coordinates where column comes first.
- Restrictions
- The text display is based upon the current font. Swithing
- fonts will cause uneven text.
- Example
-
-
- VAR ifs : ImageStkPtr;
- QuickFrame(ifs,100,100,200,50);
- FrameText(ifs,2,2,'Hello World');
-
-
-
-
-
- ___________________________________________________________________________
-
- GetMousey Function TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Waits for a mouse click and returns the number.
- Declaration
- GetMousey(ifs: ImageStkPtr): Word;
- Remarks
- ifs is the frame where we are waiting for a mouse
- click to occur. The mouse click number is returned.
-
-
-
- Programmer's Reference Guide - 32 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
- ___________________________________________________________________________
-
- GetYesNo Function TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Gets a yes or no response.
- Declaration
- GetYesNo(x,y: Word; s : String): Boolean;
- Remarks
- x,y are the coordinates to display the frame. S
- is the question to ask, allowing that the only answer
- can be Yes or No. The frame has a yes and no button
- displayed in the lower right corner.
-
- This function returns TRUE if Yes is clicked and FALSE
- if No is clicked.
- Example
-
-
- IF GetYesNo(100,100,'Do you want to erase the file') THEN
- BEGIN
- { -- erase the file }
- END
- ELSE ; { -- cancel the command }
-
-
-
-
-
- ___________________________________________________________________________
-
- EasyTEGL Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Does the necessary startup for the toolkit.
- Declaration
- EasyTEGL;
- Remarks
- This procedure should be called at the very start of
- your program. It sets up some default values and clears
- the screen.
-
- When you have become familiar with the start-up
- requirements of the TEGL Windows Toolkit then you can
- write your own initialization procedure.
-
-
-
- Programmer's Reference Guide - 33 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
-
- ___________________________________________________________________________
-
- LastCol Function TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Returns the last column of a frame as if it were in
- text mode.
- Declaration
- LastCol(ifs : ImageStkPtr): Integer;
- Remarks
- The calculation is based upon the currently selected
- font.
- Restrictions
- Does not allow for BGI fonts.
- See also
- LastRow, ColToX, RowToY.
-
-
-
- ___________________________________________________________________________
-
- LastRow Function TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Returns the last row of a frame as if it were in text
- mode.
- Declaration
- LastRow(ifs : ImageStkPtr): Integer;
- Remarks
- The calculation is based upon the currently selected
- font.
- Restrictions
- Does not allow for BGI fonts.
- See also
- LastCol, ColToX, RowToY.
-
-
-
- ___________________________________________________________________________
-
- OutFrameTextXY Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Writes text to frame relative coordinates.
- Declaration
-
- Programmer's Reference Guide - 34 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- OutFrameTextXY(ifs : ImageStkPtr; x,y: Word; s : String);
- Remarks
- Uses the currently selected font.
- Restrictions
- Does not work with BGI fonts.
- See also
- FrameText.
-
-
-
- ___________________________________________________________________________
-
- Quit Event TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Halts program.
- Declaration
- Quit(ifs: ImageStkPtr; ms: MsClickPtr): Word;
- Remarks
- Control break is set to this event by default in
- EasyTEGL.
-
-
- SetCtrlBreakFS(Quit);
-
-
-
-
-
- ___________________________________________________________________________
-
- QuickFrame Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Pushes an image and clears the frame.
- Declaration
- QuickFrame(VAR ifs : ImageStkPtr; x,y,width,
- height: Word);
- Remarks
- x,y are the desired upper left coordinates, width
- and height are the size of the frame. Coordinates
- are adjusted to fit the physical screen.
-
- After calling QuickFrame the fields x,y,x1,y1
- of the ImageStkPtr can be examined to determine the
- actual frame coordinates.
- See also
- FitFrame.
-
- Programmer's Reference Guide - 35 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- Example
-
-
-
- VAR ifs : ImageStkPtr;
-
- QuickFrame(ifs,100,100,200,150);
- FrameText(2,2,'This is too TEGL easy!');
-
-
-
-
-
- ___________________________________________________________________________
-
- RestoreFont Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Restores the current font.
- Declaration
- RestoreFont;
- Remarks
- The current font is saved when SelectEasyFont is
- called.
-
-
-
- ___________________________________________________________________________
-
- RowToY Function TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Calculates the Y coordinate for a text row.
- Declaration
- RowToY(Row : Integer): Integer;
- Remarks
- This is used to treat the graphics display as if it were
- in text mode and make it easier to place succeeding rows
- of text on the screen.
- Restrictions
- The calculation is based on the current font.
- See also
- ColToX, LastCol, LastRow, FrameText
-
-
-
- ___________________________________________________________________________
-
-
- Programmer's Reference Guide - 36 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 2 - TEGL Easy
-
- SelectEasyFont Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Changes the font.
- Declaration
- SelectEasyFont;
- Remarks
- The font used after this call is selected by previous
- call to SetEasyFont.
- See also
- RestoreFont.
-
-
-
- ___________________________________________________________________________
-
- SetEasyFont Procedure TEGLEASY
- ___________________________________________________________________________
-
-
- Function
- Set the font used by the TEGLEasy Unit.
- Declaration
- SetEasyFont(p : Pointer);
- Remarks
- Some of the routines in TEGLEasy write to the screen.
- This font is used by these routines.
- See also
- SelectEasyFont, RestoreFont
- Example
-
-
- SetEasyFont(@CountDwn);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 37 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
-
- ICONS
- ___________________________________________________________________________
-
- Icons are pictures that represent objects. This Icon image diskdrve
- represents a diskette.
-
- Icons are the mainstay of GUI's.
-
- The TEGL
- Windows Toolkit provides the tools that can create and manipulate icons up
- to a 100 x 100 pixels in size. By placing an icon within a window frame,
- they may be attached directly to an TEGL event to provide graphical menu
- selections, animated to provide visual feedback, displayed as graphic
- images like the TEGL Deck of Cards, or used to display a company logo.
-
- The ICON Editor
-
- Included in TEGL Windows is a powerful icon editor that utilizes the full
- power of the tookit to provide you with fast, flexible and easy icon file
- editing. The source code for the icon editor is also included so you can
- expand and modify it to suit your needs.
-
- The Main Bar Menu
- Open ICONDEF File
-
- Opens an existing ICON.DEF file, or creates a new DEF file. To create a new
- DEF file, type in the name of the DEF file in the filename box and click on
- key OK.
-
- Quit
- Quits the icon editor. NOTE: The icon editor does not prompt you to save your
- files.
-
-
- Editing
- The mouse cursor changes to cross-hairs when the cursor enters the
- icon drawing area. Pressing the mouse left button will place a pixel at
- the current coordinates. Pressing the mouse right button will erase the pixel.
- You can hold the mouse left or right button, while moving the mouse to
- draw or erase a series of pixels.
-
- The drawing bar at the bottom of the drawing area has two functions. Press
- and hold the right mouse button on the drawing bar to drag the drawing
- area to a new location. Click with the left mouse button on the drawing
- bar to select from the drawing menu.
-
- The Drawing Bar Menu
-
- SAVE
-
- Saves the file with the filename displayed on the drawing bar.
-
- Programmer's Reference Guide - 38 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
-
- SAVE AS
-
- Saves the file with a new filename.
-
- SAVE AND EXIT ICON FILE
- Saves the file with the filename displayed on the drawing bar and closes
- the editing area for the file.
-
- CREATE PASCAL CONSTANTS
- Creates a pascal constants file with the extension q .CON for including
- in a program.
-
- COPY IMAGE AREA
-
- Copies an area into the internal IMAGE AREA. When this option is active a
- scissors icon appears on the drawing bar. Click once with the left mouse
- button to mark the upper left corner of the area to copy. Move the mouse
- cursor to the bottom right corner of the area to copy and click again on
- the left mouse button. When the scissors disappear, the area has been
- copied to the internal IMAGE AREA.
-
- CUT IMAGE AREA
-
- Copies an area into an internal IMAGE AREA and clears the Icon area to the
- background color. When this option is active a scissors icon appears on
- the drawing bar. Click once with the left mouse button to mark the upper
- left corner of the area to cut. Move the mouse cursor to the bottom right
- corner of the area and click again on the left mouse button. When both
- the scissors disappear and the area is cleared, then the area has been
- copied to the internal IMAGE AREA.
-
- FILL IMAGE AREA
- Fills an area with the current pixel color. Bits that are already set on
- are not overwritten. When this option is active, a coffee mug icon appears
- on the drawing bar. Click once with the left mouse button to mark the
- upper left corner of the area to fill. Move the mouse cursor to the
- bottom right corner of the area and click again on the left mouse button.
- The coffee mug disappears when the area is filled with current pixel
- color.
-
- PASTE IMAGE AREA
-
- Paste the copied/cut area from the internal IMAGE AREA to the icon drawing
- area. When this option is active, a glue bottle icon appears on the
- drawing bar. Click once at the position where the image is to be pasted.
- The pasted image overwrites any pixels on the drawing area.
-
- MERGE IMAGE AREA
-
- Merges the copied/cut area from the internal IMAGE AREA to the icon
- drawing area. When this option is active, a glue bottle icon appears on
-
- Programmer's Reference Guide - 39 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
- the drawing bar. Click once at the position where the image is to
- be merged. The merged image only writes to empty pixel areas.
-
- OVERLAY IMAGE AREA
-
- Overlays the copied/cut area from the internal IMAGE AREA to the icon
- drawing area. When this option is active, a glue bottle icon appears on
- the drawing bar. Click once at the position where the image is to
- be overlayed. The overlay image only writes to active pixels.
-
- ROTATE IMAGE AREA 45 DEGREES
-
- Rotates the internal IMAGE AREA by 45 degrees.
-
- ROTATE IMAGE AREA 90 DEGREES
-
- Rotates the internal IMAGE AREA by 90 degrees.
-
- REDUCE IMAGE AREA
-
- Shrinks the image within the internal IMAGE AREA by 50%. The algorithm
- deletes every second pixel.
-
- REVERSE IMAGE AREA
-
- Reverses the image within the internal IMAGE AREA from left to right.
-
- PIXEL COLOR
-
- Pick the current pixel color from a palette of 16 colors.
-
- BACKGROUND COLOR
-
- Pick the current background color from a palette of 16 colors.
-
- CHANGE PIXELS COLOR
-
- Change all pixels with color m to another color n. Where m
- and n are selected from a palette of 16 colors. To cancel the command
- without changing any pixel colors, select the same color for both m
- and n.
-
- ERASE COLOR PIXELS
-
- Erases all pixels with the selected pixel color. The color is selected
- from a palette of 16 colors.
-
- EXPLODE ICON IMAGE
- Enlarges the drawing area. The largest size is a ratio of 3 to 1 (3 pixels
- representing 1 pixel).
-
- IMPLODE ICON IMAGE
-
- Programmer's Reference Guide - 40 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
- Shrinks the drawing area.
-
- CLEAR ICON IMAGE
- Clears the drawing area.
-
- RELOAD ICON FILE
- Reloads the original icon file.
-
- EXIT ICON FILE
- Finishes the editing of a icon file.
-
- You can open as many editing windows at once as you like. The internal
- IMAGE AREA is common to all the edit windows that are open. Consequently,
- whatever is in the internal IMAGE AREA can be pasted to any edit window.
- This allows for the building of icons from small pieces, or copying an
- icon to transform it to something different.
-
-
- ICON Constants
-
- Select from the Drawing Bar Menu CREATE PASCAL CONSTANTS, to generate
- constants for including in your program. If you have a large number of
- icons for generating constants, you can use the program ICONINC to
- generate all icons in a one pass.
-
-
- ___________________________________________________________________________
-
- Putpict Procedure FASTGRPH
- ___________________________________________________________________________
-
-
- Function
- Puts the defined icon to the specified screen area.
- Declaration
- Putpict (x,y:word; buf:pointer;n:word)
- Remarks
- x, y defines the upper left corner of the screen area for placing the
- icon image.
-
- buf points to the defined icon image.
-
- n defines the color change for any pixel that is black within the
- icon.
-
- Example
-
-
- const
- ImageMYICON : array [0..1566] of byte =
- ($1D,$06,$83,$01,$5B, $02,$ ._._._._.
-
-
- Programmer's Reference Guide - 41 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
- PutPict(10,25,@ImageMYICON,black);
-
-
-
-
-
- ICON Assembler Procedures
-
- A drawback of Turbo Pascal is the size of the data area, which limits the
- number of icons that can be included as constants.
-
- The program ICONASM provides a second method that allows you to add
- large icon images to your program (eg. the TEGL Deck of Cards).
-
- ICONASM generates a Pascal procedure in assembler. Turbo Assembler is
- required to assemble the file to object code. You may then create a TPU
- that will link the icon procedure into your pascal program.
-
-
-
- procedure ImageMyICON(x,y:word;n:word);
- {$L MyIcon.obj}
-
-
-
- To display the icon, use the icon procedure name (your icon name prefixed
- with Image).
-
-
-
- imageMyIcon(10,25,black);
-
-
-
- Note that these procedures must always be declared as far calls. If you
- make them part of the interface of a unit then it is done automatically
- but if you are using any directly in your program or accessing them
- locally in a unit then be sure and use the {$F+} directive.
-
- ICON Utilities
-
- ICONDEF
-
- ICONDEF is a utility program that allows you to strip the .DEF files
- from a turbo pascal source file, include file or Assembler file, provided
- that the commented {.. prefix is still a part of your constants.
-
- Be careful that the Input filename is not the same as one of the
- definition files. Using a suffix other then .DEF will ensure that the
- include file is not overwritten while extracting. However, any filenames
- that do end in .DEF should be copied to a subdirectory if you are not sure
- about the ICON definition names.
-
- Programmer's Reference Guide - 42 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
-
-
-
- Syntax: ICONDEF MYFILE.INC
-
- Where: MYFILE.INC is the include file generated by ICONINC
- or any file that embeds the include file.
-
-
-
- ICONLIB
-
- ICONLIB is for assisting the programmer in combining the definition
- files into a single library file for maintenance. Use ICONDEF to extract.
-
-
-
- Syntax: ICONLIB *[.DEF] MYPROG.DLB
-
- Where: *[.DEF] may use any DOS wild-card specifications.
- MYPROG.DLB may be any library filename.
-
-
-
- ICONINC
- ICONINC helps the ICON Editor in generating a large number of Turbo
- Pascal ICON constants. Multiple icon definitions may be output to a single
- include file.
-
-
-
- Syntax: ICONDEF *[.DEF] MYFILE.INC
-
- Where: *[.DEF] may use any DOS wildcards specifications.
- MYFILE.INC may be any include filename.
-
-
-
- ICONASM
-
- ICONASM is for assisting the ICON Editor in generating procedures
- from icon definition files. Multiple procedures may be output to a single
- asm file.
-
-
-
- Syntax: ICONASM *[.DEF] MYPROG.ASM
-
- Where: *[.DEF] may use any DOS wildcards specifications.
- MYPROG.ASM may be any assembler filename.
-
-
-
- Programmer's Reference Guide - 43 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 3 - Icons
-
-
- ICONS in TEGLIcon Unit
-
- There are a number of icons that have been created and are available in
- TEGLIcon unit. You can use these icons by simply including the unit
- in your USES statement.
-
-
- ImageCREDITS
-
- TEGL Windows Toolkit II
-
- ImageTRASH
- A trash can
- ImageOK
- OK button
- ImageCANCEL
- Cancel button
- ImageBLANKBUT
- A blank button for creating your own
- ImageLBUT ImageMBUT ImageRBUT
- Used by DrawLongButon to create an extra long button
- icon.
- ImageDOWN
- Down arrow.
- ImageUP
- Up arrow.
- ImageRIGHT
- Right arrow.
- ImageLEFT
- Left arrow.
- ImageR
- Registered Trademark. reg
- ImageC
- Copyright. copyright
- ImageTIGER
- A TEGL tiger.
- ImageLAST
- Last button.
- ImageNEXT
- Next button.
- ImageQUESTION
- Question Button.
-
-
-
-
-
-
-
-
-
-
- Programmer's Reference Guide - 44 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Frames
- ___________________________________________________________________________
-
- The power and speed of TEGL Windows is most apparent when handling frames.
- By automatically saving and restoring overlapping images, TEGL Windows
- is a very powerful tool for creating the illusion of separate multiple
- windows.
-
- Creating, Manipulating, and Dropping Frames
-
-
- ___________________________________________________________________________
-
- CountFrames Function TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Returns the number of frames currently on the
- stack.
- Declaration
- CountFrames: Word;
-
-
-
-
- ___________________________________________________________________________
-
- FrameExist Function TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Determines if a frame is on the frame stack.
- Declaration
- FrameExist(ifs : ImageStkPtr): Boolean
- Remarks
- If ifs exists then it contains the address
- of one of the frames on the stack.
- Example
-
-
- IF FrameExist(ifs) THEN
- DropStackImage(ifs);
-
-
-
-
-
-
-
- Programmer's Reference Guide - 45 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- ___________________________________________________________________________
-
- PushImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Used to save the background image before clearing and
- drawing new images in this area. Equivalent to opening
- a window area.
-
- Declaration
- PushImage(X,Y,X1,Y1 : word)
- Remarks
- Windows are created by pushing and popping the
- background image. X, Y, X1, Y1 are absolute
- coordinates starting with 0,0 at the upper left corner
- of the screen to GetMaxX, GetMaxY at the lower right
- corner.
- Restrictions
- Saving large images can require a lot of memory even
- with the Virtual Memory Manager. If a program is
- expected to use most of memory it would be sensible to
- include specific checks on memory requirements and
- availability before performing a PushImage.
-
- A full screen in EGA mode (640 x 350) requires about
- 110K of memory, in VGA mode (640 x 480) the requiment
- is about 150K.
- See also
- PopImage, DropStackImage, RotateStackImage,
- RotateUnderStackImage
- Example
- The following will create a shadowed box on the upper
- left screen area. Use the right mouse button to drag
- the box around.
-
-
-
- { samc0401.pas }
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- PopImage Procedure TEGLUNIT
-
- Programmer's Reference Guide - 46 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- ___________________________________________________________________________
-
-
- Function
- Used to restore the top background image after a
- PushImage. Equivalent to closing a window area.
- Declaration
- PopImage
- Remarks
- Restores the uppermost image area created by PushImage.
-
- See also
- PushImage, DropStackImage, RotateStackImage,
- RotateUnderStackImage
- Example
- This example waits until a mouse button is pressed then
- calls PopImage to restore the background image.
-
-
- { samc0402.pas }
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
-
- WHILE Mouse_Buttons = 0 DO;
- PopImage;
-
-
-
-
-
-
- ___________________________________________________________________________
-
- RotateStackImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Rotates a frame forward or backward relative to the
- frames on the screen.
- Declaration
- RotateStackImage(var Frame1,Frame2)
- Remarks
- Frames may be rotated to the foreground to allow user
- input or updates, etc.
-
- A frame may be rotated as the first frame using
- RotateUnderStackImage.
-
- In order to access an image that is not the most recent
- PushImage you must save the Global Variable
- StackPtr right after the PushImage. The saved
-
- Programmer's Reference Guide - 47 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- pointer may be used to manipulate the frame.
- Restrictions
- A frame can only be rotated above a known frame. To
- rotate a frame below another frame on the stack, use
- the RotateUnderStackImage routine.
- See also
- PushImage, PopImage, DropStackImage
- Example
- The following example creates two overlapping frames
- and waits for a click of a mouse button before
- rotating the bottom frame to the top.
-
-
- { samc0403.pas }
- VAR fs : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- FS := stackptr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
-
- WHILE Mouse_Buttons = 0 DO;
-
- RotateStackImage(fs,stackptr);
-
-
-
-
-
- ___________________________________________________________________________
-
- RotateUnderStackImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Rotates a frame forward or backward relative to the
- frames on the screen. Rotates a frame below Frame2.
- Declaration
- RotateUnderStackImage(VAR Frame1,Frame2)
- Remarks
-
- In order to access an image that is not the most recent
- PushImage you must save the Global Variable
- StackPtr right after the PushImage. The saved
- pointer may be used to manipulate the frame.
- Restrictions
- A frame can only be rotated below a known frame. To
- rotate a frame above another frame on the stack, use
- the RotateStackImage.
-
- Programmer's Reference Guide - 48 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- See also
- PushImage, PopImage, DropStackImage
- Example
- The following example creates two overlapping frames
- and awaits for a click of a mouse button before
- rotating the Top frame under the second frame.
-
-
- { samc0404.pas }
- VAR FS : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- FS := StackPtr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
-
- WHILE Mouse_Buttons = 0 DO;
-
- RotateUnderStackImage(StackPtr,fs);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- DropStackImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Used to close a frame that is not necessarily the
- topmost image on the stack. Equivalent to closing a
- window area.
- Declaration
- DropStackImage(VAR Frame: ImageStkPtr)
- Remarks
- Restores an image area created by PushImage.
-
- In order to access an image that is not the most recent
- PushImage you must save the Global Variable
- StackPtr right after the PushImage. The saved
- pointer may be used to manipulate the frame.
- See also
- PushImage, PopImage, RotateStackImage,
- RotateUnderStackImage
- Example
- The following example creates two overlapping frames
- and awaits for a click of a mouse button before
-
- Programmer's Reference Guide - 49 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- dropping the bottom frame from the screen.
-
-
- { samc0405.pas }
- VAR fs : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
-
- WHILE Mouse_Buttons = 0 DO;
-
- DropStackImage(fs);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- HideImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Hides an Image Frame from the screen but retains the
- current stack position and frontal image.
- Declaration
- HideImage(VAR Frame)
- Remarks
- This procedure may be used in a variety of ways.
- Blinking a frame by alternating between HideImage and
- ShowImage. Moving a frame from one location to another.
- See also
- ShowImage
- Example
- The following example blinks a frame continuously until
- a mouse button is pressed.
-
-
-
- { samc0406.pas }
- VAR fs : ImageStkPtr;
- i : word;
-
- PushImage(1,1,50,50);
- ShadowBox(1,1,50,50);
- fs := StackPtr;
-
- Programmer's Reference Guide - 50 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- i := 20000;
- REPEAT
- dec(i);
- IF i=10000 THEN
- HideImage(fs);
- IF i=0 then
- BEGIN
- ShowImage(fs,fs^.x,fs^.y);
- i := 20000;
- END;
- UNTIL Mouse_Buttons<>0;
-
- IF i<=10000 THEN
- ShowImage(fs,fs^.x,fs^.y);
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- ShowImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Shows a Hidden Image Frame.
- Declaration
- HideImage(VAR Frame)
- See also
- HideImage
- Example
- The following example moves a frame from one location
- to another when a mouse button is pressed.
-
-
- { samc0407.pas }
- VAR fs : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
-
- WHILE Mouse_Buttons = 0 DO;
-
- HideImage(fs);
-
- Programmer's Reference Guide - 51 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- ShowImage(fs,fs^.x+100,fs^.y+100);
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- ShowCoordinates Event DEBUGUNT
- ___________________________________________________________________________
-
-
- Function
- A TEGL Event that displays the coordinates of a frame.
- Declaration
- ShowCoordinates(ifs : ImageStkPtr; Ms : MsClickPtr): Word;
- Remarks
- This event displays the coordinates of a frame.
-
-
- Preparing a Frame for Update
-
-
- ___________________________________________________________________________
-
- PrepareForPartialUpdate Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Prepares a portion of a frame for output. Removes all
- overlapping images above the partial area that is being
- updated on the screen.
- Declaration
- PrepareForPartialUpdate(VAR Frame; X,Y,X1,
- Y1: word)
- Remarks
- X,Y,X1,Y1 are absolute coordinates starting with 0,0 at
- the upper left corner of the screen to GetMaxX, GetMaxY
- at the lower right corner.
- Restrictions
- The coordinates must be within the absolute frame
- coordinates. Use the current Frame coordinates +
- offsets to obtain the correct absolute coordinates.
-
- PrepareForPartialUpdate and PrepareForUpdate can
- be used on multiple frames (provided the update areas
- do not overlap) but must be matched by an equal number
- of calls to CommitUpdate.
- See also
-
- Programmer's Reference Guide - 52 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- PrepareForUpdate, CommitUpdate
- Example
- The following example creates two overlapping frames
- and awaits for a click of a mouse button before drawing
- a circle on the bottom frame.
-
-
- { samc0408.pas }
- VAR FS,LsPtr : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
-
- WHILE Mouse_Buttons = 0 DO;
-
- PrepareForPartialUpdate(fs,fs^.x,fs^.y,fs^.x1,fs^.y1);
- SetColor(Blue);
- Circle(fs^.x+48,fs^.y+45,40);
- CommitUpdate;
-
-
-
-
-
-
- ___________________________________________________________________________
-
- PrepareForUpdate Function TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Prepares a frame for output. Removes all overlapping
- images above the frame area that is being updated on
- the screen.
- Declaration
- PrepareForUpdate(VAR Frame)
- Remarks
- Identical to PrepareForPartialUpdate, except the
- current Frame Coordinates are passed automatically.
- Restrictions
- PrepareForPartialUpdate and PrepareForUpdate can
- be used on multiple frames (provided the update areas
- do not overlap) but must be matched by an equal number
- of calls to CommitUpdate.
- See also
- PrepareforPartialUpdate, CommitUpdate
- Example
-
- Programmer's Reference Guide - 53 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- The following example creates two overlapping frames
- and awaits for a click of a mouse button before drawing
- a circle on the bottom frame.
-
-
- { samc0409.pas }
- VAR fs : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
-
- WHILE Mouse_Buttons = 0 DO;
-
- PrepareForUpdate(fs);
- SetColor(blue);
- Circle(fs^.x+48,fs^.y+45,40);
- CommitUpdate;
-
-
-
-
-
-
- ___________________________________________________________________________
-
- CommitUpdate Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Commits update. Replaces all overlapping images above
- the frame area that was being updated on the screen.
- Declaration
- CommitUpdate;
- Remarks
- CommitUpdate must be used to close the functions
- PrepareForPartialUpdate and PrepareForUpdate.
- Restrictions
- CommitUpdate must be called an equal number of
- times for each PrepareForPartialUpdate and
- PrepareForUpdate.
- See also
- PrepareForPartialUpdate, PrepareForUpdate
- Example
- The following example creates two overlapping frames
- and awaits for a click of a mouse button before drawing
- a circle on the bottom frame.
-
-
- Programmer's Reference Guide - 54 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- {samc0410.pas }
- VAR FS : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
-
- WHILE Mouse_Buttons = 0 DO;
-
- PrepareForUpdate(fs);
- SetColor(blue);
- Circle(fs^.x+48,fs^.y+45,40);
- CommitUpdate;
-
-
-
-
- Moving a Frame
-
-
- ___________________________________________________________________________
-
- FrameSelectAndMove Function TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Allows a frame to be moved. This routine is normally
- called by the TEGL supervisor when the right mouse
- button is held down and the mouse cursor is positioned
- over a frame.
-
- Declaration
- FrameSelectAndMove(mxpos,mypos : word): ImageStkPtr;
- Result type
- Returns a pointer to the frame that the mouse had
- selected and moved.
- Remarks
- The movement of the Frame is under the control of the
- user until the mouse button is released. To move a
- frame under program control, use MoveStackImage.
-
- Restrictions
- This function returns immediately if neither mouse
- button is held down on entry.
-
- See also
- SetMoveRestrictions, SetFrameMobility,
-
- Programmer's Reference Guide - 55 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- SetMoveFrameCallProc, MoveStackImage
- Example
- The following example displays a green mouse cursor and
- calls FrameSelectAndMove whenever the right mouse
- button is pressed. The routine exits and changes the
- mouse cursor back to white when the left mouse button
- is pressed.
-
-
- VAR FS : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- ShowMouse;
- SetMouseColor(green);
- REPEAT
- IF Mouse_Buttons=2 THEN
- fs := FrameSelectAndMove(Mouse_Xcoord,Mouse_Ycoord);
- UNTIL Mouse_Buttons = 1;
- SetMouseColor(white);
-
-
-
-
-
- ___________________________________________________________________________
-
- SetAutoRotate Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Sets the frame stack auto rotate function.
- Declaration
- SetAutoRotate(OnOff: Boolean);
- Remarks
- Auto rotate is normally set to FALSE. That is, a frame
- will not automatically rotate to the top of the stack.
- When set to TRUE any frame that is partially covered
- will be moved to the top of the stack when
- TEGLSupervisor detects a left mouse button click
- anywhere on the frame.
- Example
-
-
- { -- after this frames jump to the top with a click of the mouse }
- SetAutoRotate(TRUE);
-
-
-
-
- Programmer's Reference Guide - 56 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
-
-
- ___________________________________________________________________________
-
- SetMoveRestrictions Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Sets the minimum and maximum coordinates that a frame
- may be moved.
- Declaration
- SetMoveRestrictions(sh VAR frame; x,y,x1,y1:
- word)
- Remarks
- Sets the area that a frame is restricted to when
- FrameSelectAndMove is called.
- Restrictions
- The restriction does not apply when a frame is moved
- using MoveStackImage.
- See also
- FrameSelectAndMove, SetFrameMobility,
- SetMoveFrameCallProc, MoveStackImage
- Example
- The following sets the frame mobility to the upper half
- of the screen. Use the right mouse button to move the
- frame around.
-
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- SetMoveRestrictions(StackPtr,0,0,GetmaxX,GetmaxY div 2);
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- SetFrameMobility Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Toggles the ability for a frame to move.
- Declaration
- SetFrameMobility(sh VAR frame; movable:
- boolean)
- Remarks
-
- Programmer's Reference Guide - 57 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- When the mobility of a frame is set to off (false), the
- frame outline will move when FrameSelectAndMove is
- called, however, the frame is not moved to the new
- location when the mouse button is released.
-
- The default frame mobility is ON (true).
- Restrictions
- The mobility toggle has no effect when a frame is moved
- using MoveStackImage.
- See also
- FrameSelectAndMove, SetMoveRestrictions,
- SetMoveFrameCallProc, MoveStackImage
- Example
- The following example toggles a frames mobility to off.
-
-
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- SetFrameMobility(StackPtr,false);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- SetMoveFrameCallProc Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- An event process that is called after an frame has been
- dragged to a new screen position.
- Declaration
- SetMoveFrameCallProc(sh VAR frame : ImageStkPtr;
- P : CallProc);
- Remarks
- Can be used for the trash can effect, originating with
- the MacIntosh, by which file icons are dragged to the
- trash can to be deleted from the system.
-
- The event may check the MouseClickPos Record (fields
- MS.X, MS.Y, MS.X1, and MS.Y1) for the new frame
- location and whether they overlap the desired frame.
- Restrictions
- If you wish for the frame to move to the new location,
- the event must call MoveStackImage before returning.
- See also
- FrameSelectAndMove, SetMoveRestrictions,
- SetFrameMobility, MoveStackImage
-
- Programmer's Reference Guide - 58 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Example
- The following is a very simple Event Handler that
- simply closes the frame if the frame is moved.
-
-
- Function Poof(Frame:ImageStkPtr; MouseClickPos : MsClickPtr) : Word;
- BEGIN
- HideMouse;
- DropStackImage(frame);
- ShowMouse;
- Poof := 0;
- END;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- SetMoveFrameCallProc(StackPtr,Poof);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- MoveStackImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Move a frame to a new screen location.
- Declaration
- MoveStackImage(sh VAR Frame; x,y : word)
- Remarks
- Used to move a frame under Program control to a new
- screen location. X and Y are absolute coordinates that
- specify the upper left corner of the frame at the new
- location.
- Restrictions
- The coordinates are not validated, so care must be
- taken to ensure that the resulting coordinates of the
- lower right corner falls within the screen area.
- See also
- FrameSelectAndMove, SetMoveRestrictions,
- SetFrameMobility, SetFrameCallProc
- Example
- The following example moves a smaller frame under
- another larger frame to demonstrate the integrity of
- stacked images.
-
-
- VAR fs : ImageStkPtr;
- i : word;
-
- Programmer's Reference Guide - 59 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- PushImage(1,1,20,20);
- ShadowBox(1,1,20,20);
- fs := StackPtr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
-
- FOR i:=1 to 100 DO
- MoveStackImage(fs,fs^.x+2,fs^.y+2);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- MoveFrame Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Moves an Xor wire frame from one location to
- another.
- Declaration
- MoveFrame(VAR fx,fy,fx1,fy1 : Integer;
- rx,ry,rx1,ry1: Integer; Color: Integer);
- Remarks
- This only moves a wire frame not the actual frame.
- The mouse button must be held down on entry or this
- function returns immediately. rx,ry,rx1,ry1 are
- the starting coordinates. fx,fy,fx1,fy1 are the
- coordinates when the mouse button is released.
- Color is the wireframe color.
-
-
- Low Level Frame Functions
-
-
- ___________________________________________________________________________
-
- UnLinkFS Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Disconnects a frame from the stack.
- Declaration
- UnLinkFS(sh VAR Frame)
- Remarks
-
- Programmer's Reference Guide - 60 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- UnLinkFS allows you to disconnect a frame from the
- Image stack to stop any further actions by the frame
- manager.
-
- This procedure is used throughout the window management
- routines. It is provided as an external routine only
- for specialized needs.
- Restrictions
- This procedure should be used in conjunction with
- HideImage, ShowImage, CreateImageBuffer,
- DropImageBuffer, and LinkFS.
-
- If you unlink a frame from the stack without first
- hiding the frame, the stack manager will not
- acknowledge the existence of the frame and will
- overwrite the unlinked frame area.
- See also
- LinkFS, LinkUnderFS
- Example
- The following example hides the frame before unlinking
- and dropping the image.
-
-
- VAR FS : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
-
- WHILE Mouse_Buttons = 0 DO;
-
- HideImage(fs);
- UnLinkFS(fs);
- DropImageBuffer(fs);
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- LinkFS Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Reconnects a frame to the stack.
-
- Programmer's Reference Guide - 61 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Declaration
- LinkFS(sh VAR Frame1,Frame2)
- Remarks
- LinkFS reconnects Frame1 with the Frame stack, above
- Frame2.
-
- This procedure is used throughout the window management
- routines. It is provided as an external routine only
- for specialized needs.
- Restrictions
- This procedure should be used in conjunction with
- HideImage, ShowImage, CreateImageBuffer,
- DropImageBuffer, and UnLinkFS.
- See also
- UnLinkFS, LinkUnderFS
- Example
- The following example performs the same function as
- RotateStackImage.
-
-
- VAR FS : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
-
- WHILE Mouse_Buttons = 0 DO;
-
- HideImage(fs);
- UnLinkFS(fs);
- LinkFS(fs,StackPtr);
- ShowImage(fs,fs^.x,fs^.y);
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- LinkUnderFS Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Reconnects a frame with the frame stack, below the
- specified frame.
- Declaration
-
- Programmer's Reference Guide - 62 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- LinkUnderFS(sh VAR Frame1,Frame2)
- Remarks
- LinkUnderFS reconnects Frame1 below Frame2.
-
- This procedure is used throughout the window management
- routines. It is provided as an external routine only
- for specialized needs.
- Restrictions
- This procedure should be used in conjunction with
- HideImage, ShowImage, CreateImageBuffer,
- DropImageBuffer, and UnLinkFS.
- See also
- UnLinkFS, LinkFS
- Example
- The following example performs the same function as
- RotateUnderStackImage.
-
-
- VAR fs1,fs2 : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs1 := StackPtr;
-
- PushImage(50,50,150,150);
- ShadowBox(50,50,150,150);
- fs2 := StackPtr;
-
- WHILE Mouse_Buttons = 0 DO;
-
- HideImage(fs2);
- UnLinkFS(fs2);
- LinkUnderFS(fs2,fs1);
- ShowImage(fs2,fs2^.x,fs2^.y);
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- CreateImageBuffer Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Allocates an Image buffer (frame) on the Heap.
- Declaration
- CreateImageBuffer(VAR Frame; x,y,x1,y1:word)
- Remarks
-
- Programmer's Reference Guide - 63 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- This procedure is used throughout the window management
- routines. It is provided as an external routine only
- for specialized needs.
- Restrictions
- This procedure should be used in conjunction with
- HideImage, ShowImage, CreateImageBuffer,
- DropImageBuffer, and UnLinkFS.
- See also
- DropImageBuffer
- Example
- The following example performs the same function as
- PushImage.
-
-
- VAR FS : ImageStkPtr;
-
- CreateImageBuffer(fs,1,1,100,100);
- LinkFs(fs,StackPtr);
- GetBiti(1,1,100,100,fs^.imagesave);
-
- ShadowBox(1,1,100,100);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- DropImageBuffer Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Frees the memory used by the frame on the heap.
- Declaration
- DropImageBuffer(VAR Frame)
- Remarks
- This procedure is used throughout the window management
- routines. It is provided as an external routine only
- for specialized needs.
- Restrictions
- This procedure should be used in conjunction with
- HideImage, ShowImage, CreateImageBuffer,
- DropImageBuffer, and UnLinkFS.
- See also
- CreateImageBuffer
- Example
- The following example performs the same function as
- PopImage.
-
-
-
- Programmer's Reference Guide - 64 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- VAR FS : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- WHILE Mouse_Buttons = 0 DO;
-
- UnlinkFS(fs);
- DropImageBuffer(fs);
-
-
-
-
-
-
-
- ___________________________________________________________________________
-
- GetFSImage Function TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Retrieves the screen image within a stacked frame.
- Declaration
- GetFSImage(Frame)
- Result type
- Returns a (non-stacked) frame containing the screen
- image and other related frame information.
- Remarks
- The (non-stacked) frame may be used for replication or
- it can be merged with other frames.
- See also
- PutFSImage
- Example
- The following example creates a single frame and
- replicates the frame.
-
-
-
- VAR FS,TS : ImageStkPtr;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- ts := GetFSImage(fs);
- PushImage(51,51,150,150);
- PutFSImage(51,51,ts,FGNORM);
- DropImageBuffer(ts);
-
-
- Programmer's Reference Guide - 65 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
-
-
-
-
- ___________________________________________________________________________
-
- PutFSImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Places the frame saved image anywhere on the screen.
- Declaration
- PutFSImage(x,y,Frame,RWBITS)
- Remarks
- RWBITS are constants defined in EGAGRAPH which
- defines how the images are placed on the screen.
-
- FGNorn
- replaces screen area with frame image
- FGAnd
- AND's screen area with frame image. Toggles off screen
- areas that do no have a frame image. Creates an outline
- of the frame image.
- FGOr
- OR's screen area with frame image. Toggles on empty
- screen areas that have a frame image. Creates a solid
- frame image.
- FGXor
- XOR's screen area with frame image.
- FGNot
- Inverts frame image and replaces screen area with
- image.
-
- See also
- GetFSImage
- Example
- The following example creates a single frame and
- replicates the frame.
-
-
- VAR fs,ts : ImageStkPtr;
- i : word;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- fs := StackPtr;
-
- ts := GetFSImage(fs);
-
- FOR i:=1 to 20 DO
-
- Programmer's Reference Guide - 66 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- BEGIN
- PushImage(1+i*10,1+i*10,100+i*10,100+i*10);
- PutFSImage(1+i*10,1+i*10,ts,FGNOT);
- END;
-
- DropImageBuffer(ts);
-
-
-
-
-
- ___________________________________________________________________________
-
- FreeImageBuffer Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Frees up the memory allocated for a frame buffer.
- Declaration
- FreeImageBuffer(VAR ifs : ImageStkPtr);
- Remarks
- This is generally an internal function. Do not use
- it unless you have a clear understanding of inner
- workings of the frame stack.
-
-
-
- ___________________________________________________________________________
-
- GetPartialFrontImage Function TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Gets the partial image of a frame and returns a
- pointer to a temporary buffer.
- Declaration
- GetPartialFrontImage(Frame: ImageStkPtr;
- x,y,x1,y1 : Word) : ImageStkPtr;
- Remarks
- This is a safer way to get the partial
- image of a frame than using GetBiti.
- Overlapping frames are partially removed and
- then restored before returning.
-
-
-
-
- ___________________________________________________________________________
-
- Programmer's Reference Guide - 67 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- GetFrontImage Function TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Get the image of a frame and returns a pointer to
- a temporary buffer.
- Declaration
- GetFrontImage(ifs : ImageStkPtr): ImageStkPtr;
- Remarks
- This is a safer way to get the image of a
- frame than using GetBiti. Overlapping
- frames are partially removed and then restored
- before returning.
-
-
-
- ___________________________________________________________________________
-
- PageInFS Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Read an image into memory.
- Declaration
- PageInFS(VAR ifs : ImageStkPtr);
- Remarks
- If the image is already in memory then no action
- is taken.
- See also
- PageOutFS.
- Example
- This example checks to see if the image is in
- memory first before attempting to read it in.
- Note that PageInFS check this automatically
- before reading in an image.
-
-
- IF ifs^.ImagePageOut THEN { -- the image is not in memory }
- PageInFS(ifs);
-
-
-
-
-
- ___________________________________________________________________________
-
- LockImage Procedure TEGLUNIT
-
- Programmer's Reference Guide - 68 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- ___________________________________________________________________________
-
-
-
- Function
- Locks an frame image into memory.
- Declaration
- LockImage(VAR ifs : ImageStkPtr);
- Remarks
- The image is read into memory if required. The
- lock is maintained until a specific call is made
- to UnLockImage.
-
- Lock image can be used where it is desirable to
- replicate an image on the screen repeatedly. After
- it is locked then it can be placed on the screen
- with a call to PutBiti.
- Restrictions
- This should be used with caution especially if you
- are locking in a large image. You can fragment the
- heap and the Virtual Memory Manager may not be able
- to allocate a large enough memory block for
- subsequent image swaps.
- See also
- UnLockImage, UseImage, UnUseImage
- Example
- If the image is less than 64k then it can be copied
- to Turbo's heap and then the image can be unlocked
- reducing the chance of a heap error.
-
-
-
- VAR ifs : ImageStackPtr;
- buf : Pointer;
-
- PushImage(100,100,300,150);
- ifs := StackPtr;
- ShadowBox(100,100,300,150);
- { -- do something with the frame }
- { -- then lock it so its not swapped out }
- LockImage(ifs);
- { -- allocate memory on Turbo's Heap }
- GetMem(buf,ifs^.ImageSize);
- { -- move it there }
- buf^ := ifs^.imagesave;
- { -- unlock the image }
- UnLockImage(ifs):
-
-
-
-
-
-
- Programmer's Reference Guide - 69 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- ___________________________________________________________________________
-
- PageOutFS Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Page out a frame image.
- Declaration
- PageOutFS(VAR ifs : ImageStkPtr);
- Remarks
- If the image is successfully paged out to
- EMS or disk then TEGLFreeMem is called
- to free up the memory used.
- Restrictions
- If ifs is in use, or locked or already
- paged out then no action is taken.
- See also
- PageInFS.
- Example
-
-
-
- PageOutFS(ifs);
- IF ifs^.ImagePageOut THEN { -- success }
- ELSE ; { -- failure }
-
-
-
-
-
- ___________________________________________________________________________
-
- SetImageCoordinates Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Sets the frame pointer to a new set of coordinates.
- Declaration
- SetImageCoordinates(VAR ifs : ImageStkPtr;
- x,y,x1,y1 : Word);
- Remarks
- A frame's coordinates should not be changed if it is
- visible.
-
-
-
- ___________________________________________________________________________
-
-
- Programmer's Reference Guide - 70 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- PageOutImageStack Function TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Requests the virtual memory manager to page out
- images to make a chunk of memory available.
- Declaration
- PageOutImageStack(Mem : LongInt) : Boolean
- Remarks
- Mem is the amount of memory required. A large
- value for Mem will result in all image buffers
- being paged out. This function returns true if the
- amount of memory requested has been freed.
- Restrictions
- Large amounts of memory are required to process
- image swapping. If you allocate too much and don't
- free it up as quickly as possible you may get a
- heap error.
-
- Example
-
-
- { -- force all imagebuffers to disk }
- IF PageOutImageStack(512000) THEN; { -- ignore result }
- { -- do whatever needs that much memory }
- SuperSortMemUse(MaxAvail);
- SuperSort;
- { -- release it before working with windows again }
- SuperSortFreeMem;
-
-
-
-
-
-
- ___________________________________________________________________________
-
- UnLockImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Unlocks a frame image.
- Declaration
- UnLockImage(VAR ifs : ImageStkPtr);
- Remarks
- Unlock simply sets a flag in the ImageStkPtr.
- After unlocking, the Virtual Memory Manager can
- swap the image to EMS or Disk as required. If the
-
- Programmer's Reference Guide - 71 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- image wasn't locked then no action is taken.
- Restrictions
- See restrictions for LockImage.
- See also
- LockImage, UseImage, UnUseImage.
- Example
- See example for LockImage.
-
-
-
-
- ___________________________________________________________________________
-
- UnUseImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Flags a frame image as no longer in use.
- Declaration
- UnUseImage(VAR ifs : ImageStkPtr);
- Remarks
- This should be called as soon as possible after
- a UseImage to keep as much memory free for
- the Virtual Memory Manager.
- See also
- UseImage, LockImage, UnLockImage.
- Example
-
-
- UseImage(ifs);
- { -- do something with it }
-
- { -- then let the memory manager swap it out if required }
- UnUseImage(ifs);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- UseImage Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Makes an image available for use.
- Declaration
-
- Programmer's Reference Guide - 72 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- UseImage(VAR ifs : ImageStkPtr);
- Remarks
- The frame image is read into memory if not
- already then and then flagged as being in
- use.
- Restrictions
- If you do PrepareForUpdate then the
- in use flag is set to false.
- See also
- UnUseImage, LockImage, UnLockImage.
- Example
-
-
- UseImage(ifs);
- { -- do something with it }
-
- { -- then let the memory manager swap it out if required }
- UnUseImage(ifs);
-
-
-
-
-
-
- Mouse Click Areas
-
- Mouse click areas are those places on the screen where we sense if the
- mouse pointer has passed over or has been clicked on. Frames can have
- mouse click areas on them that are, of course, only available if the frame
- is visible and the mouse click area is uncovered.
-
- The sensitivity of the mouse click area has two levels. The most sensitive
- is MsSense where just having the mouse pointer pass over the area
- causes an action. The other level is MsClick where the mouse pointer
- must be over the mouse click area and the left mouse button has been
- pressed.
-
-
-
- ___________________________________________________________________________
-
- DefineMouseClickArea Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
-
- Function
- Attaches an sensitive area of a frame to an event
- function.
- Declaration
- DefineMouseClickArea(VAR ifs : ImageStkPtr; x,y,x1,y1:
- Integer; Active : Boolean; P : CallProc, Sense: Boolean);
-
- Programmer's Reference Guide - 73 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Remarks
- ifs is any ImageStkPtr. The x, y, x1, y1 are coordinates
- relative to a frame. This means that the upper left
- corner of a frame is considered 0,0.
-
- Active is a boolean flag to indicate whether the Mouse
- Click Area is an active entry True or a place holder
- False in a list of mouse clicks. A place holder is
- simply a defined entry with no action recognized.
-
- p is the event to call when the Mouse Click Area
- is activated, either by the mouse pointer passing by
- the click areas or a mouse click occurring on an click
- area.
-
- NilUnitProc may be used to define a no-event
- handler. This may be used in conjunction with the
- functions FindFrame and CheckMouseClickPos to
- check for the respective mouse click activation.
-
- NilUnitProc may also be used as a temporary
- parameter. Use ResetMSClickCallProc to add the proper
- event handler later.
-
- Sense is either MSSense or MSClick. MSSense activates
- the event handler whenever the mouse cursor passes over
- the defined mouse click areas. MSClick requires the
- right mouse button to be pressed while the mouse cursor
- is on the mouse click area.
- Restrictions
- The number of mouse click areas is limited only by
- memory. Overlapping click area take priority over
- underlying click areas.
-
- The coordinates of a Mouse click area must reside
- within the Frame, otherwise the click areas are not
- recognized.
- See also
- FindMouseClickPtr, ResetMouseClicks,
- ResetMSClickSense, ResetMSClickCallProc,
- ResetMSClickActive, CheckMouseClickPos
- Example
- The following example creates a frame that attaches an
- 'OK' icon with an Event Handler called DropBoxOption
- which simply closes the frame and exits.
-
- The function CheckforMouseSelect is used to create
- the illusion of a button being pressed when clicked on.
-
-
-
- Function DropBoxOption(Frame:ImageStkPtr; MouseClickPos: MSClickPtr):WORD;
-
- Programmer's Reference Guide - 74 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- BEGIN
- IF CheckforMouseSelect(Frame)<>nil then
- BEGIN
- Hidemouse;
- DropStackImage(Frame);
- ShowMouse;
- END;
-
- DropBoxOption := 0;
- END;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- PutPict(50,80,@ImageOk,black);
- DefineMouseClickArea(StackPtr,50,80,50+35,80+12,true,
- DropBoxOption,MSClick);
-
-
-
-
-
- ___________________________________________________________________________
-
- FindMouseClickPtr Function TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Searches for a Mouse Click Pointer associated with a
- Mouse Click Number.
- Declaration
- FindMouseClickPtr(VAR ifs : ImageStkPtr; Clicknumber:
- Word);
- Result type
- Returns a mouse click pointer (MSClickPtr), pointing to
- a Mouse Click Record.
- Remarks
- Click Numbers are in the order that you define the
- Mouse Click areas. The first DefineMouseClickArea is
- known as Click Number 1, the second is Click Number 2,
- etc..
-
- In certain instances it is easier to advance through
- the mouse click areas by Click Numbers. However, most
- functions, including the calling of Events, pass the
- Mouse Click Pointer.
-
- To translate a Mouse Click Pointer back to a Click
- Number, use the Mouse Click Pointer fields ie.
- ClickNumber := MouseClickPos^.ClickNumber where
- MouseClickPos is of type MSClickPtr.
- Restrictions
-
- Programmer's Reference Guide - 75 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- FindMouseClickPtr returns a Nil if the clicknumber is
- not found. Compare the resulting MSClickPtr with Nil
- before referencing the record.
- See also
- DefineMouseClickPtr, ResetMouseClicks,
- ResetMSClickSense, ResetMSClickCallProc,
- ResetMSClickActive, CheckMouseClickPos
- Example
- The following example defines an array of 100 Mouse
- Click Areas. You may click with the left mouse button
- on the individual tiles to produce a sound, or on the
- 'OK' to produce a series of sounds.
-
- The function FindMouseClickPtr is used within the
- event handler PlayAllNotes to translate a random
- click number into a note.
-
- The function CheckforMouseSelect is used to create
- the illusion of a button being pressed when clicked on.
-
-
-
-
- VAR x,y : word;
-
- Function PlayOneNote(Frame:ImageStkPtr;
- MouseClickPos: MSClickPtr):WORD;
- BEGIN
- ToggleOptionBar(Frame,MouseClickPos,nil);
- Beep(MouseClickPos^.clicknumber*10,1,100);
- ToggleOptionBar(Frame,nil,MouseClickPos);
- PlayOneNote := 0;
- END;
-
- Function PlayAllNotes(Frame:ImageStkPtr;
- MouseClickPos: MSClickPtr):WORD;
- VAR i,rs : word;
- BEGIN
- IF CheckforMouseSelect(Frame)<>nil THEN
- BEGIN
- FOR i:=1 to 30 DO
- rs := PlayOneNote(Frame,FindMouseClickPtr(Frame,
- random(100)+1));
- END;
- PlayAllNotes := 0;
- END;
-
- PushImage(1,1,107,124);
- ShadowBox(1,1,107,124);
-
- FOR x:=0 to 9 DO
- FOR y:=0 to 9 DO
-
- Programmer's Reference Guide - 76 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- BEGIN
- ShadowBox(StackPtr^.x+3+x*10,StackPtr^.y+3+y*10,
- StackPtr^.x+3+10+x*10,StackPtr^.y+3+10+y*10);
- DefineMouseClickArea(StackPtr,3+x*10,3+y*10,
- 3+x*10+6,3+y*10+6,true,PlayOneNote,MSClick);
- END;
-
- Putpict(StackPtr^.x+50,StackPtr^.y+105,@imageok,black);
- DefineMouseClickArea(StackPtr,50,105,50+35,105+12,true,
- PlayAllNotes,MSClick);
-
-
-
-
-
- ___________________________________________________________________________
-
- ResetMSClickActive Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Resets the active flag to indicate whether a Mouse
- Click Area Entry is active or inactive.
- Declaration
- ResetMSClickActive(VAR ifs: ImageStkPtr;
- MouseClickNumber : Word; Active : Boolean);
- Remarks
- The MouseClickNumber is in the order that you defined
- the Mouse Click areas. The first DefineMouseClickArea
- is known as MouseClickNumber 1, the second is
- MouseClickNumber 2, etc..
-
- Active is a boolean flag to indicate whether the Mouse
- Click Area is an active entry (True) or a place holder
- (False) in a list of mouse clicks. A place holder is
- simple a defined entry with no action recognized.
- Restrictions
- If the MouseClickNumber is invalid, the flag is not
- updated.
- See also
- DefineMouseClickPtr, ResetMouseClicks,
- FindMouseClickPtr, ResetMSClickSense,
- ResetMSClickCallProc, CheckMouseClickPos
- Example
- This example creates an array of 10 buttons which all
- point to the same Event Handler SwitchOn. The
- active flag for a pressed button is turned off to
- prevent multiple calls to SwitchOn, until another
- button is pressed. ResetMSClickActive is used
- within SwitchOn to toggle the button Active state.
-
-
- Programmer's Reference Guide - 77 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
-
-
- VAR x,y : word;
-
- function SwitchOn(Frame:ImageStkPtr;
- MouseClickPos: MsClickPtr) : word;
- VAR i : word;
- ms : msclickptr;
- BEGIN
- Beep(1500,1,10);
-
- FOR i:=1 to Frame^.MSClickCount DO
- BEGIN
- MS := FindMouseClickPtr(Frame,i);
- IF NOT MS^.MSActive THEN
- BEGIN
- HideMouse;
- PutPict(Frame^.x+MS^.ms.x,Frame^.y+MS^.ms.y,
- @imageBlankBut,black);
- ResetMSClickActive(Frame,MS^.ClickNumber,true);
- ShowMouse;
- END;
- END;
-
- HideMouse;
- PutPict(Frame^.x+MouseClickPos^.ms.x,
- Frame^.y+MouseClickPos^.ms.y,@ImageOk,black);
- ShowMouse;
- PressButton(Frame,MouseClickPos);
- ResetMSClickActive(Frame,MouseClickPos^.ClickNumber,false);
-
- SwitchOn := 1;
- END;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
-
- FOR x:=0 to 1 DO
- FOR y:=0 to 4 DO
- BEGIN
- Putpict(StackPtr^.x+6+x*42,StackPtr^.y+6+y*18,
- @imageBlankBut,black);
- DefineMouseClickArea(StackPtr,5+x*42,5+y*18,
- 5+x*42+35,5+y*18+12,true,SwitchOn,MSClick);
- END;
-
-
-
-
-
- ___________________________________________________________________________
-
- Programmer's Reference Guide - 78 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
-
- ResetMSClickCallProc Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Changes the Event Handler for a Mouse click to another
- Event Handler.
- Declaration
- ResetMSClickCallProc(ifs : ImageStkPtr; MouseClickNumber:
- Word; P : CallProc);
- Remarks
- MouseClickNumbers are in the order that you define the
- Mouse Click areas. The first DefineMouseClickArea is
- known as MouseClickNumber 1, the second is
- MouseClickNumber 2, etc..
-
- p is the event to pass control to when the mouse
- click area is actived.
-
- NilUnitProc may be used to define a no-event
- handler. This may be used in conjunction with the
- functions FindFrame and CheckMouseClickPos to
- check for the respective mouse click activation.
-
- NilUnitProc may also be used to deactivate an
- event handler.
- See also
- DefineMouseClickPtr, ResetMouseClicks,
- FindMouseClickPtr, ResetMSClickSense,
- ResetMSClickActive, CheckMouseClickPos
- Example
- This example switches between two events that play a
- different series of sounds. The function
- CheckforMouseSelect is used to create the illusion of
- a button being pressed when clicked on.
-
-
-
- function FirstSong(Frame:ImageStkPtr;
- MouseClickPos: MsClickPtr): word; FORWARD;
-
- function SecondSong(Frame:ImageStkPtr;
- MouseClickPos: MsClickPtr): word;
- BEGIN
- IF CheckforMouseSelect(Frame)<>nil THEN
- BEGIN
- Beep(1500,5,100);
- ResetMSClickCallProc(frame,
- MouseClickPos^.ClickNumber,FirstSong);
- END;
- SecondSong := 1;
-
- Programmer's Reference Guide - 79 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- END;
-
- function FirstSong(Frame:ImageStkPtr;
- MouseClickPos: msclickptr) : word;
- BEGIN
- IF CheckforMouseSelect(Frame)<>nil THEN
- BEGIN
- SlideBeep(500,1500,2);
- ResetMSClickCallProc(frame,
- MouseClickPos^.ClickNumber,SecondSong);
- END;
- FirstSong := 1;
- END;
-
- PushImage(1,1,100,100);
- ShadowBox(1,1,100,100);
- Putpict(StackPtr^.x+51,StackPtr^.y+81,@ImageOk,black);
- DefineMouseClickArea(StackPtr,50,80,50+35,80+12,
- true,FirstSong,MSClick);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- ResetMouseClicks Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Removes a chain of mouse click areas from a frame.
- Declaration
- ResetMouseClicks(Frame,ClickPtr:MSClickPtr)
- Remarks
- The ClickPtr parameter is the last click pointer from
- where the remainder of the chain of click areas will be
- removed.
-
- A parameter of Nil removes the Mouse Click Area
- chain completely.
- Restrictions
- The ClickPtr should be a valid Mouse Click Ptr. Use
- FindMouseClickPtr to locate a valid pointer.
-
- If ClickPtr is invalid, the parameter will be treated
- as Nil.
- See also
- DefineMouseClickPtr, FindMouseClickPtr,
- ResetMSClickSense, ResetMSClickCallProc,
- ResetMSClickActive, CheckMouseClickPos
-
- Programmer's Reference Guide - 80 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Example
- The following example displays a varying number of bars
- that can be selected. The Event Handler
- ShowBarList plays a sound corresponding to the bar
- selected and clears the frame and re-displays a new
- series of bars.
-
-
-
- Function ShowBarList(Frame:ImageStkPtr;
- MouseClickPos: MSClickPtr):WORD; FORWARD;
-
- Procedure ShowVaryList(fs:ImageStkPtr; N:word);
- VAR y : word;
- BEGIN
- ResetMouseClicks(fs,nil);
- FOR y:=0 to n DO
- BEGIN
- ShadowBox(fs^.x+5,fs^.y+3+y*10,fs^.x1-8,fs^.y+3+10+y*10);
- DefineMouseClickArea(StackPtr,5,3+y*10,
- fs^.x1-fs^.x-10,3+y*10+6,true,ShowBarList,MSClick);
- END;
- END;
-
- Function ShowBarList(Frame:ImageStkPtr;
- MouseClickPos: MSClickPtr):WORD;
- BEGIN
- ToggleOptionBar(Frame,MouseClickPos,nil);
- Beep(MouseClickPos^.clicknumber*30,10,100);
- HideMouse;
- ShadowBox(frame^.x,frame^.y,frame^.x1,frame^.y1);
- ShowVaryList(frame,random(10)+1);
- ShowMouse;
- END;
-
- PushImage(1,1,107,124);
- ShadowBox(1,1,107,124);
- ShowVaryList(StackPtr,random(10)+1);
-
-
-
-
-
-
- ___________________________________________________________________________
-
- ResetMSClickSense Procedure TEGLUNIT
- ___________________________________________________________________________
-
-
- Function
- Resets the Sense parameter associated with a Mouse
-
- Programmer's Reference Guide - 81 - TEGL Windows Toolkit
-
-
-
-
-
- Chapter 4 - Frames
-
- Click Area.
- Declaration
- ResetMSClickSense(VAR ifs : ImageStkPtr; NewSense :
- Boolean;)
- Remarks
- NewSense is either MSSense or MSClick. MSSense
- activates the event handler whenever the mouse cursor
- passes over the defined mouse click areas. MSClick
- requires the right mouse button to be pressed while the
- mouse cursor is on the mouse click area.
- Restrictions
- ResetMSClickSense resets the Sense type for the chain
- of all Mouse Clicks. If you have a mixture of different
- senses, use a combination of FindMouseClickPtr and
- field settings to reset the sense.
- See also
- DefineMouseClickPtr, ResetMouseClicks,
- FindMouseClickPtr, ResetMSClickCallProc,
- ResetMSClickActive, CheckMouseClickPos
- Example
- The following example requires a menu selection to
- toggle between the menu dropping down automatically or
-