Introduction Part 1 Learning Turbo Vision Chapter 1 Inheriting the Wheel Chapter 2 Writing Turbo Vision Applications
Total Page:16
File Type:pdf, Size:1020Kb
c o N T E N T s Introduction 1 Chapter 2 Writing Turbo Vision Why Turbo Vision? ...... ..... ...... 1 applications 23 What is Turbo Vision? ....... ..... 1 Your first Turbo Vision application .. .. 2S What you need to know . .. ... ... 2 The desktop, menu bar, and status line . 25 What's in this book? . .. ... .. ... .. .. 2 The desktop ..... ... .... .. .. " 26 ll1e status line ... .. .. ..... .... , 26 Part 1 Learning Turbo Vision Creating new commands . .. .. .... 27 Chapter 1 Inheriting the wheel 7 ll1e menu bar . ... .. .. ...... .. 28 The framework of a windowing A note on structure . .. 30 application. .. 7 Opening a window . .. 31 A new Vision of application development. 8 Standard window equipment. .. 31 The elements of a Turbo Vision Window initialization . .. .. 33 application . .. 9 The Insert method . ... .......... 33 Naming of parts ... .. .. : .... 9 Closing a window . .. 34 Views .......... .. .... .. 9 Window behavior . .. 34 Events .. .... .. .. .. .. .. 9 Look through any window . 35 Mute objects . .. 10 What do you see? ........ .. .... 37 A common "look and feel" .. ....... 10 A better way to Write .. ..... .. 38 "Hello, World!" Turbo Vision style ... 12 A simple file viewer . 38 Running HELLO.PAS . ....... .. 13 Reading a text file ... ....... .. 39 Pulling down a menu ... ..... ... 14 Buffered drawing . .. 40 A dialog box . .... ... ... ... 15 The draw buffer ...... ... ...... 40 Buttons . ..... .. ...... .. .. ..... 15 Moving text into a buffer ........ 41 Getting out . 16 Writing buffer contents ... .. .... 41 Inside HELLO.PAS .. .. .... ... ... .. 16 Knowing how much to write . ... 42 ll1e application object . .. .... ... .. 17 Scrolling up and down . ......... .. 42 ll1e dialog box object . .. .. .. .... 18 Multiple views in a window . .. 45 Flow of execution and debugging .... 19 Where to put the functionality ' " . 46 HELLO's main program. 19 Making a dialog box .... .. .. , . .. 47 ll1e lnit method .. ........... .. 20 Executing a modal dialog box . .. .. 49 TI1e Run method . .. 20 Taking control . 50 ll1e Done method ..... ... .. 21 Button, button... .. 50 Summary . .. .. .. .... ........ .. 21 Nonnal and default buttons " .. .. 52 Focused controls ..... ....... .. ' . 52 Take your pick ....... ........ 53 Creating a duster 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 53 Frames. 0 0 0 • •• 0 0 0 0.' 0 . 0 •• 0 0 0 o. 0 0 75 Check box values 00 0 000 0 000000000 53 Buttons 0 •• • 0 0 • • 0 0 • o • • 0 • 0 • 0 00 •• 0 0 75 One more cluster 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 54 Clusters o. 0 • • 0 0 0 0 • • 0 0 0 0 0 • o. 0 • • 0 0 75 Labeling the controls 0 0 0 0 0 0 0 0 0 0 0 00 0 0 55 Menus 0 ••• 00 • • 0. 0. o. 0 " 0 0 •• • 0. 0 0 75 TI1e input line object 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 Histories 0 0 • 0 •• 0 • • • • 0 • 0 • • 0 • 0 0 • 0 0 0 76 Setting and getting data 0 0 0 0 0 0 0 0 0 •• 00 56 Input lines o. 0 •• 0 •• • 0 •• 0 • •• 0 0 0 0 0 0 76 Shortcut keys and conflicts o. 0 0 • • 0 0 0 0 59 List viewers 0 0 • • • 0 • 0 • 0 • • • 0 0 0 • 0 • 0 0 76 Ending the dialog box 0 0 0 0 0 0 0 •• 0 • 0 0 0 61 Scrolling objects 0 0 • 0 0 0 0 • 0 0 0 0 0 • 0 0 0 76 Other dialog box controls o. 0 • 0 0 0 • • 0 0 • • 61 Text devices 0 • • • 0 • 0 ••• • • • 0 0 • • • • •• 77 Static text .. 0 0 0 • ••••• o. 0 • • 0 •• 0 • • • • • 61 Static text ... 0 •• 0 •••••• 0 0 •• • • o. 77 List viewer 0 0 • • • 0 • 0 •• 0 0 0 • • • 0 0 • • 0 •• 0 61 Status lines 0 • 0 0 • •• •• • 0 0 • • 0 0 • 0 • • • 0 78 List box .. 0 • 000 0 00 .0 00 • • • • ••• 0 o •• 0 62 Non-visible elements 0 0 •• • 0 •• 0 • •• 0 0 • o. 78 fiistory . 0 0 0 0 0 • 0 0 0 0 0 0 0 0 0 0 0 0 • • 0 0 • 0 0 0 62 Streams 0 0 0 0 •• • 00 ••• 0.00 0. o. o. 0 • ••• 78 Standard dialog boxes 0 0 0 0 0 0 0 • 0 • • 0 0 • •• 62 DOS streams . 0 0 0 0 0 • • • 0 0 0 0 0 • 0 0 • 0 0 79 Buffered streams 0 0 • 0 0 • • • • • 0 0 •• 0 0 0 79 Part 2 Programming Turbo Vision EMS streams 0 0 0 0 0 0 0 • 0 0 0 0 0 0 0 0 • 0 0 0 79 Chapter 3 The object hierarchy 65 Resources .. 0 • 0 0 0 0 0 0 0 • • •• 0 • 0 • 0 0 • 0 •• 79 Collections 0 0 0 • 0 0 0 0 0 0 0 0 0 • 0 • 0 •• 0 • • o. 79 Object typology 0 • 0 0 0 0 0 0 0 • 0 0 0 0 0 0 0 0 0 0 0 0 67 Sorted collections .. .. 0 •• • • 0 80 Abstract objects 0 0 • 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 67 String collections 0 0 0 0 • ••• 0 0 • • • • 0 0 0 80 Abstractmetl10ds 0 • • • • o. 0 0 0 0 o. 0 0. 00 68 Resource collections 0 • 0 ••• 0 0 •• 0 •• 0 80 Object instantiations and derivations 0 0 0 68 String lists 0 0 0 0 0 • 0 0 •• 0 0 • 0 0 • 0 0 0 0 • • o. 80 Instantiation 0 0 0 0 0 0 0 0 0 0 0 • 0 • • 0 0 0 0 0 • • 68 Derivation 0 0 0 0 0 0 0 0 0 0 •• 0 0 0 0 0 0 •• 0 0 0 0 69 Chapter 4 Views 81 Turbo Vision methods 0 0 0 0 0 •• • 0 0 0 0 ••• 0 69 "We have taken cantrol of your TV .. 0" 81 Abstract methods . 0 0 0 0 0 0 •• •• 0 0 0 • •• 69 Simple view objects ... 0 0 • 0 •• 0 0 0 0 • 0 0 0 0 82 Pseudo-abstract methods 0 0 0 • 0 • 0 0 0 • 0 70 Setting your sigh ts . .. 0 0 0 •••• 0 0 0 0 • 0 0 82 Virtual methods . 0 0 • 0 0 ••• • 0 • • • • • • •• 70 Getting the TPoint 000 • • • • 00 • • 000 • • 83 Static methods 0 • • 0 • 0 • 0 0 •••• 0 • 0 • • ••• 70 Getting into a TRect 0 • 0 • • o. 0 • •• 0 o. 83 Turbo Vision fields 0 0 • 0 0 0 •• 0 •• 0 • 0 • • 0 •• 70 Turbo Vision coordinates . o ••• 000 0 84 Primitive object types. 0 •• ••• 0 0 • • • 0 • • • • 71 Making an appearance .. 0 0 0 0 0 • 0 0 0 0 0 0 84 TPoint 00 •• 0 0 0 . 000 .0 00 .0 0 .0 . 0 •• 0 . 00 72 Territoriality .. 0 0 0 0 • 0 0 0 •• 0 • •• • 0 0 0 85 TRect. 0 0.00 ••• : •• • 00 •• 0 o. o. o. 0 •• • •• 72 Drawing on demand 0 0 0 0 0 0 • 0 0 • •• 0 85 TObject .. 0 • 0 • • , 0 •• •• 0 0 ••• 0 0 0 • 0 0 • 0 0 72 Putting on your best behavior . 0 • 0 • • • 85 Views .. 0 0 o. 0.0 ••• 000 • • 0 ••• • 0 •• 0 ••• 0 72 Complex views 0 0 0 •• 0 0 0 0 0 •• 0 0 0 0 0 0 0 0 0 0 86 Views overview .. 0 • 0 0 0 • •••••••• " 73 Groups and subviews 0000000 . 0 • 0 00 0 86 Groups. 0 •• 0 . 0. 00 •• • 0000 •••• • 000 . 0 73 Getting into a group . 0 0 0 0 • 0 • 0 • 0 •• 0 • • 87 The abstract group . 0 0 0 • • 0 • 0 : 0 0 , 0 0 73 Another angle on Z-order 0 0 • •• • 0 0 0 88 Desktops .0 . 0 •• 0 00 0 000 0 .0 0 ' : • 0 • 0 74 Group portraits 0 • 0 0 • 0 0 0 0 • 0 0 0 0 • • 0 • • 0 89 Programs . ... .. 0 • ••••• 0 •• • • • 0 74 Relationships between views . 0 0 0 • • ,0 90 Applications . .. 0 0 0 0 •• •• • 0 0 • 0 •• • 74 The object hierarchy . 0 • •• 0 0 0 0 •• 0 • 0 91 Windows .. 0 0 0 • • • 0 0 • • 00 0 •• • o. 0 0 , 74 Ownership 0 • 0 0 0 • 0 • 0 0 • 0 • 0 • 0 • 0 0 0 0 0 91 Dialog boxes . 0 0 0 0 0 0 •• • 0 • 0 0 • 0 • o. 74 Subviews and view trees 0 0 • 0 • • 0 0 0 0 0 0 92 Terminal views 0 ••• • 0 0 0 0 0 •• 0 • 0 0 • 0 o. 75 75 SeJected and focused views . .. 95 Chapter 5 Event-driven 75 Finding the focused view .. .... .. 96 programming 109 75 How does a view get the focus? .. .. 96 Bringing Turbo Vision to life ... .. .. 109 75 The focus chain . .. 97 Reading the user's input . .......... 109 76 Modal views . .. ... ......... ...... 97 The nature of events .. ... ... ......... 1111 76 Modifying default behavior . .......... 98 Kinds of events .... .. 111 76 TIle Options flag word . 98 Mouse events .................. 112 7 ofSelectabJe . .. ............... 99 Keyboard events . .. 112 n ofTopSelect ... ... ...... .... 99 Message events . ............... 112 77 ofFirstGick . .... ... .. ........... 99 "Nothing" events ............... 112/ 78 ofFramed .. ... ... ............ 99 Events and commands. .. 113 78 ofPreProcess ... ... ... .... ..... 99 Rou ting of events ........... .. ... 113 7 ofPostProcess . 99 Where do events come from? ....... 113 79 ofBuffered ... .. ... .. .... .. 100 Where d o events go? ..... .. ... .... 114 79 ofTileable . .. 100 Positional events. .. 114 79 ofCenterX ..... .. ... .... , 100 Focused events ..... .. ...... .. 115 79 ofCenterY . ......... .. .. ... ... 100 Broadcast events . .. 115 79 ofCentered . .. 101 User-defined events ... ..... .. 116 TIle GrowMode flag byte . ...... 101 Masking events . ................. 116 o gfGrow LoX ......... .. ... ... 101 Phase . .. ... ..... ............ ... 116 o gfG rowLoY .............. .. ... 101 The Phase field . ...... .. ....... 118 o gfGrow HiX ... .. .............. 101 Commands ..... ........... ...... 119 gfGrowHiY . .. ...... ... 101 Defining commands . .. 119 gfGrow All . .. ... .. ... .. .. .. 101 Binding commands .. .. ....... .. 120 gfGrowRel ..... ..... .. .. .. 101 Enabling and disabling commands .. 120 TIle DragMode flag byte ..... .. ... 102 Handling events ... .. 121 dmDragMove ....... ... :... ... 102 The event record.