An Introduction to Controls - PowerPoint PPT Presentation

1 / 53
About This Presentation
Title:

An Introduction to Controls

Description:

An Introduction to Controls Rainer Becker dFPUG / ISYS GmbH Germany – PowerPoint PPT presentation

Number of Views:95
Avg rating:3.0/5.0
Slides: 54
Provided by: Rain124
Category:

less

Transcript and Presenter's Notes

Title: An Introduction to Controls


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
  • Properties
  • Data
  • Method
  • Layout
  • Other
  • Controls
  • Libs
  • Locks
  • 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 gt Label control
  • GET-Field gt Text box
  • Edit Region gt Edit box
  • Popup gt Combo box
  • Radio button gt Optionb.
  • Push button gt Command
  • Screen(Set) gt Form (Set)
  • Picture gt 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
Properties Visible 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, ColorSch
eme/Source, ToolTip SpecialEffect,
Curvature --- - Shapes in front block the click
event
  • Data
  • Methods
  • Layout
  • Other
  • Tips

23
Properties Plain 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 AboveSource
  • ToolTipText ToolTip if Form.ShowTips.T.
  • SpecialEffect Plain or 3D
  • Curvature 0rectangle - 99circle

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,
(StyleInv.) 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-delimite
    d)
  • 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 (0None), (1Value) )

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 -gt ID
  • ItemIDToIndex ID -gt 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
--- AddObject, RemoveObject ButtonCount Buttons -
ChangeEvents only in Groups - No Inheritance for
new buttons
  • Data
  • Methods
  • Layout
  • Other
  • Tips

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

51
Ease your work!
Builders
  • Textbox
  • Editbox
  • Listbox
  • Combo-Box
  • Option Group
  • Command Group
  • Grid
  • Design-Only Methods
  • - Read/Write-Method
  • - Read/Write-Expression
  • ASelObj( )
  • You will love them!

52
Where to go from here? Related Sessions
  • The Form Designer - Alan Schwartz
  • Advanced Visual FoxPro Controls - Ted Roche
  • Using the Grid Control in the Real World - Whil
    Hentzen
  • OLE Custom Controls in Visual FoxPro - Steven
    Black
  • Builders in Visual FoxPro - Steven Black
  • Using Visual FoxPro Classes - Ken Levy
  • ( The Class Browser - Ken Levy )
  • ( Building applications using class libraries -T.
    M. T.-F. )

53
Questions?
  • Check the VFP-sample files!
  • RichTextFormat-Manuals...
  • (or better click through the really big
    help-file)

????????
Write a Comment
User Comments (0)
About PowerShow.com