1 / 53

An Introduction to Controls

An Introduction to Controls. Rainer Becker dFPUG / ISYS GmbH Germany. About the Speaker. German FoxPro User Group ISYS GmbH MS Solution Provider MS Consulting Services Adress: Rainer Becker, Messerschmittstr. 2a, 65760 Eschborn, Germany Phone: 01149-6173-68182, Fax: -65997

landis
Télécharger la présentation

An Introduction to Controls

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Introduction to Controls Rainer Becker dFPUG / ISYS GmbH Germany

  2. About the Speaker • German FoxPro User Group • ISYS GmbH • MS Solution Provider • MS Consulting Services • Adress: Rainer Becker, Messerschmittstr. 2a, 65760 Eschborn, Germany Phone: 01149-6173-68182, Fax: -65997 • CompuServe: 100024,1364 / GO MSCESYS

  3. Whats included • Short Introduction to principles of Properties/Events/Methods • Guided Tour through all Controls - walking all properties upstairs • Some words about Containers, Naming, Builders

  4. Whats excluded • Form Designer • Class Designer • Grid-Control • OLE-Controls (but you might get a good base for all of that) • Classes • Inheritance • Non-Visual Objects • Event-Model

  5. Form Designer Toolbars • Controls • Libs • Locks • Properties • Data • Method • Layout • Other • Layout • Palette • Design

  6. Vocabulary • What are Properties ? • What are Methods ? • What are Events ? • How to avoid confusion? • How to reference objects ?

  7. What are PROPERTIES? • Think of them as bound variables • Public vars with a private path • Example: COMMENT, HEIGHT • Add your own! • Later on you will need them - especially for non-visual objects or even applications

  8. What are METHODS? • Think of them as old-style snippets • Procedures bound to Controls/Forms • Example: Refresh, SetFocus • Add your own! • You will sometimes need them - but building your own is real fun!

  9. What are EVENTS? • Think of them as old-style snippets • Procedures bound to Windows-Events • Example: old-fashioned VALID, CLICK • You can not extend! • Events are methods bound to OS/VFP/USER • You normally need only some of them - but it is great that there are so many!

  10. Avoid Confusion • Events and Methods have a Procedure • Events could be seen as an Event + Method • Some Properties are followed by actions • These Categories are not closed boxes • There are many - but most are easy to use! • Obey Graphical hints: Bold = changed, Italic = read-only • Use RESET TO DEFAULT (right mouse button)

  11. Syntax • objectvariable.[form.]control.property = Setting • THIS. • THISFORM. • THISFORMSET. • _SCREEN. • WITH.. ..ENDWITH, COUNT / PAGES • ACTIVEFORM. • ACTIVEPAGE. • ACTIVECONTROL. • PARENT.

  12. Controls - A Guided Tour • Timers • Lines • Shapes • Images • Labels • Command Buttons • Option Buttons • Check Boxes • Text Boxes • Edit Boxes • Spinners • Combo Boxes • List Boxes • Option Groups • Command Groups • Page Frames • Grids • OLE-Controls

  13. Not all of them are new! Renamed Controls • Text => Label control • GET-Field => Text box • Edit Region => Edit box • Popup => Combo box • Radio button => Optionb. • Push button => Command • Screen(Set) => Form (Set) • Picture => Image • Really new are: • Timers • Page • Grid • OCX • Nearly all are enhanced!

  14. Lets start with a new but small one Timers • Data • Methods • Layout • Other • Tips Comment, Tag BASIC, TimerEvent, Reset COORDINATES CLASS, Interval - Not executed while Menu open - Not exact enough for RealTime

  15. Timer & Basic Data/Layout • Timer (one of each) • TimerEvent Procedure called at Event • ResetMethod Restart timer • IntervalProp. Timer in milliseconds • Data • Comment You should use it! • Tag Free property • Layout • Top, Left, Heigth, Width

  16. Basic Other • Other • Name Naming conventions • Enabled logical Flag • Class Objects belong to classes • ClassLibrary optional: VCX of the class • Baseclass Base class derived from • Parentclass optional: derived from • Parent runtime: container object

  17. Basic Events/Methods • Events • Init Object initialised • Destroy Object removed • Error local error-handler • Methods • CloneObject runtime duplication • SaveAsClass objects from VCX to VCX • Read/WriteExpression/Method at design time

  18. Lines • Data • Events • Methods • Layout • Other • Tips --- CLICK, MOUSE, DRAG Drag, Move, UIEnable, ZOrder DragIcon/Mode, BORDER,Draw- Mode, MousePointer, LineSlant HelpContextID - No 3D-line-effects

  19. Click & Mouse EventsVisible Objects • Click • Click Mouse left click • DblClick Mouse double click • RightClick Mouse right click • Mouse • MouseMove Mouse over object • MouseDown Mouse pressed for click • MouseUp Mouse released • MousePointer 12 pointer versions

  20. Drag & Drop Visible Objects • Drag • DragDrop End of drag, target event • DragOver object over target, target event • Methods • Drag Method for manual dragging • Move Method for manual moving • Properties • DragIcon Cursor Icon for drag • DragMode automatic / manual

  21. PropertiesVisible Objects • Bordercolor, -style, -width for border • Visible Temporary hide object • HelpContextID for HelpCompiler • ZOrder Meth. active Page, tlb order • UIEnable Evt. Page activate event • Drawmode 16 different modes (Line/Shape/Form) • LineSlant special line property

  22. Shapes --- --- BackColor/Style, FillColor/Style, ColorScheme/Source, ToolTip SpecialEffect, Curvature --- - Shapes in front block the click event • Data • Methods • Layout • Other • Tips

  23. PropertiesPlain Objects • Colors • BackStyle Transparent / Opaque (Default) • BackColor RGB-Color for Qpaque objects • FillColorStyle Transparent, Solid, Lines • FillColor RGB-Color if not transparent • ColorScheme Object/Form/Source/Default • ColorSource Scheme for Above=Source • ToolTipText ToolTip if Form.ShowTips=.T. • SpecialEffect Plain or 3D • Curvature 0=rectangle - 99=circle

  24. Images • Data • Methods • Layout • Other • Tips --- --- Picture(Bitmap, Icon) Stretch (Clip/Isometric/Stretch) --- - Stretch also used for OLE

  25. Labels • Data • Methods • Layout • Other • Tips --- --- Caption, FONT, COLOR AutoSize, WordWrap, Alignment --- - The Caption can be a function

  26. Layout PropertiesObjects with Caption • FontName & FontSize • FontFlags FontBold, FontItalic, FontStrikeThru, FontOutline, FontUnderline, FontShadow • Color DisabledBackColor, (Disabled)ForeColor • Caption Text to be shown (function) • Alignment Left/Right/Centered • AutoSize Resize horiz. for text • WordWrap Wrap words/resize vertical

  27. Command Buttons • Data • Methods • Layout • Other • Tips TerminateRead ErrorMessage, see EVENTS DownPicture, DisabledPicture StatusBarText, (Style=Inv.) TabIndex, TabStop (Forms!) Default, Cancel (not \! or \? ) - Use small fonts with pictures - Use StatusBarText instead

  28. Eventsfor accessible objects • When old-fashioned WHEN • Valid old-fashioned VALID • GotFocus Tabbed to it • LostFocus Tabbed somewhere else... • SetFocus Method (enabled & visible) • KeyPress Key Preview Event ! • Refresh SHOW GET (Requery,Page) • Message Return Message text (Old!)

  29. Option Buttons • Data • Methods • Layout • Other • Tips ControlSource Field or memvar Value same type as the --- ControlSource Alignment (Left/Right) for button SpecialEffect not for command button --- - Only in Option Button Groups!

  30. Avoid Confusion • Name object name • Caption title • ControlSource differs • memvar • field • function • Value object value

  31. Check Boxes • Data • Methods • Layout • Other • Tips --- InteractiveChangeEvent ProgrammaticChangeEvent --- --- - ProgrammaticChange important!

  32. Text Boxes • Data • Methods • Layout • Other • Tips Format, InputMask, Margin, Read- Only, Open/MemoWindow RangeHigh, RangeLow SELECT, Style (SAY-compatible), PasswordChar HideSelection - Play with selected areas!

  33. Selected Text • SelStart Begin of selection • SelLength Number of chars • SelText Complete Selected text • HideSelection Show after LostFocus • SelectedForeColor Text color • SelectedBackColor Background color

  34. Edit Boxes • Data • Methods • Layout • Other • Tips MaxLength --- ScrollBars (vert. & horiz.) AllowTabs - “Selected text” applies here

  35. Spinners • Data • Methods • Layout • Other • Tips KeyboardHigh/LowValue, Spin- nerHigh/LowValue, Increment UpEvent, DownEvent --- --- - Use High/LowValues instead of RangeEvents

  36. Combo Boxes • Data • Methods • Layout • Other • Tips BoundColumn, DisplayValue AddItem, AddListItem, ColumnCount, -Lines, -Width Disabled/Select/Item/Back/ForeC TopIndex, TopItemID, +NEW IncrementalSearch, Listcount, ListIndex, ListIdemID

  37. LayoutCombo box • ColumnCount Number of Columns • ColumnLines Show column lines • ColumnWidth Width of columns (colon-delimited) • ItemBack/ForeColor • SelectedItemBack/ForeColor • DisabledItemBack/ForeColor

  38. DataCombo box • RowSourceType 9 options • RowSource name type • BoundColumn Column bound to Value • DisplayValue Text or pos. for display • ItemData Additional value • List Array of text • Sorted Alphabetically sorted • FirstElement, NumberOfElements for Arrays

  39. Methods & OtherCombo box • Methods • Requery Requery SQL/QPR-Source • Other • IncrementalSearch self-explanatory • TopIndex first visible item • NewIndex last AddItem-position • Listcount Number of items • ListIndex (Last) selected item

  40. What are IDs?Combo box • ItemIDData Additional value by ID • ListItem Array of text by ID • Other • TopItemID ID of topmost vis. list-item • NewItemID last AddItem-ID • ListItemID (Last) selected item ID ( List + ListItem / ListIndex + ListItemID) ( RowSourceType (0=None), (1=Value) )

  41. ID-MethodsCombo box • AddItem Add at position • AddListItem Add with ID • RemoveItem Remove from position • RemoveListItem Remove with ID • Clear Delete all items • IndexToItemID Position -> ID • ItemIDToIndex ID -> Position

  42. List Boxes • Data • Methods • Layout • Other • Tips --- --- --- MultiSelect - Use DisplayValue and Value together for text and offset

  43. Container Hierarchy • FrameSet • Frame • PageFrame • Page • Grid • Column • Option Group • Command Group • Frame • PageF,Grid,Controls • Page • Grid, Controls • Column • Header, Controls • Option Buttons • Command Buttons

  44. Option/Command Button Groups • Data • Methods • Layout • Other • Tips --- AddObject, RemoveObject ButtonCount Buttons - ChangeEvents only in Groups - No Inheritance for new buttons

  45. Page Frames • Data • Methods • Layout • Other • Tips ActivePage --- PageCount, PageHeight/Width, Tabs, TabStretch Pages (Array) -Drop objects on top for all pages

  46. Pages • Data • Methods • Layout • Other • Tips Controls (Array) --- ControlCount PageOrder, KeyPreview - Reference all with PAGES.

  47. Grids • See: Using the Grid Control - Whil Hentzen

  48. OLE-Controls • OLE Bound Controls • "bound" to Genearl-fields • no own Events • OLE Container Controls • OCX with own Events • OLE unbound to fields • See: OLE Custom Controls - Steven Black PicClip, Outline, Word 6.0, O-Gramm, Graph, Excel, Comm, ClipArt, PowerPoint, Formula Editor

  49. Container-Confusion • Container Objects • FrameSet, Frame, PageFrame, Page, Grid, Column, Option Group, Command Group • Control Objects • protected • Custom Objects • non-visual

  50. Naming Conventions • chk Check box • cbo Combo box • cmd Command • cmg Com. group • cnt Container • ctl Control • (cus Custom) • edt Edit box • frm Form • frs Form set • grd Grid • grc Grid column • grh Grid header • img Image • lbl Label • lin Line • lst List box • olb OLE-bound • ole OLE • opt Option button • opg Option group • (otl Outline) • pag Page • pgf Page Frame • sep Separator • shp Shape • spn Spinner • txt Text box • tmr Timer • tbr Toolbar

More Related