Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations

Presentation on theme: "An Introduction to Controls Rainer Becker dFPUG / ISYS GmbH Germany."— Presentation transcript:

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

2 About the Speaker n German FoxPro User Group n ISYS GmbH n MS Solution Provider n MS Consulting Services n Adress: Rainer Becker, Messerschmittstr. 2a, Eschborn, Germany Phone: , Fax: n CompuServe: ,1364 / GO MSCESYS

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

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

5 Form Designer n Controls –Libs –Locks n Properties –Data –Method –Layout –Other n Layout n Palette n Design Toolbars

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

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

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

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

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


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

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

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

15 Timer & Basic Data/Layout n Timer(one of each) –TimerEventProcedure called at Event –ResetMethodRestart timer –IntervalProp.Timer in milliseconds n Data –CommentYou should use it! –TagFree property n Layout –Top, Left, Heigth, Width

16 Basic Other n Other –NameNaming conventions –Enabledlogical Flag –ClassObjects belong to classes –ClassLibraryoptional: VCX of the class –BaseclassBase class derived from –Parentclassoptional: derived from –Parentruntime: container object

17 Basic Events/Methods n Events –InitObject initialised –DestroyObject removed –Errorlocal error-handler n Methods –CloneObjectruntime duplication –SaveAsClassobjects from VCX to VCX –Read/WriteExpression/Method at design time

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

19 Click & Mouse Events Visible Objects n Click –ClickMouse left click –DblClickMouse double click –RightClickMouse right click n Mouse –MouseMoveMouse over object –MouseDownMouse pressed for click –MouseUpMouse released –MousePointer12 pointer versions

20 Drag & Drop Visible Objects n Drag –DragDropEnd of drag, target event –DragOver object over target, target event n Methods –DragMethod for manual dragging –MoveMethod for manual moving n Properties –DragIconCursor Icon for drag –DragModeautomatic / manual

21 Properties Visible Objects n Bordercolor, -style, -width for border n VisibleTemporary hide object n HelpContextIDfor HelpCompiler n ZOrder Page, tlb order n UIEnable Evt.Page activate event n Drawmode16 different modes (Line/Shape/Form) n LineSlantspecial line property

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

23 Properties Plain Objects n Colors –BackStyleTransparent / Opaque (Default) –BackColorRGB-Color for Qpaque objects –FillColorStyleTransparent, Solid, Lines –FillColorRGB-Color if not transparent –ColorSchemeObject/Form/Source/Default –ColorSourceScheme for Above=Source n ToolTipTextToolTip if Form.ShowTips=.T. n SpecialEffectPlain or 3D n Curvature0=rectangle - 99=circle

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

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

26 Layout Properties Objects with Caption n FontName & FontSize n FontFlags FontBold, FontItalic, FontStrikeThru, FontOutline, FontUnderline, FontShadow FontOutline, FontUnderline, FontShadow n Color DisabledBackColor, (Disabled)ForeColor n CaptionText to be shown (function) n AlignmentLeft/Right/Centered n AutoSizeResize horiz. for text n WordWrapWrap words/resize vertical

27 Command Buttons n Data n Methods n Layout n Other n 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 Events for accessible objects n Whenold-fashioned WHEN n Validold-fashioned VALID n GotFocusTabbed to it n LostFocusTabbed somewhere else... n SetFocusMethod (enabled & visible) n KeyPressKey Preview Event ! n RefreshSHOW GET (Requery,Page) n MessageReturn Message text (Old!)

29 Option Buttons n Data n Methods n Layout n Other n Tips ControlSourceField or memvar Valuesame type as the ---ControlSource Alignment (Left/Right) for button SpecialEffect not for command button Only in Option Button Groups!

30 Avoid Confusion n Nameobject name n Captiontitle n ControlSource differs »memvar »field »function n Valueobject value

31 Check Boxes n Data n Methods n Layout n Other n Tips ---InteractiveChangeEventProgrammaticChangeEvent ProgrammaticChange important!

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

33 Selected Text n SelStartBegin of selection n SelLengthNumber of chars n SelTextComplete Selected text n HideSelectionShow after LostFocus n SelectedForeColorText color n SelectedBackColorBackground color

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

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

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

37 Layout Combo box n ColumnCount Number of Columns n ColumnLinesShow column lines n ColumnWidth Width of columns (colon-delimited) n ItemBack/ForeColor n SelectedItemBack/ForeColor n DisabledItemBack/ForeColor

38 Data Combo box n RowSourceType9 options n RowSourcename type n BoundColumnColumn bound to Value n DisplayValueText or pos. for display n ItemDataAdditional value n ListArray of text n SortedAlphabetically sorted n FirstElement, NumberOfElements for Arrays

39 Methods & Other Combo box n Methods –RequeryRequery SQL/QPR-Source n Other –IncrementalSearchself-explanatory –TopIndexfirst visible item –NewIndexlast AddItem-position –ListcountNumber of items –ListIndex(Last) selected item

40 What are IDs? Combo box n ItemIDDataAdditional value by ID n ListItemArray of text by ID n Other –TopItemIDID of topmost vis. list-item –NewItemIDlast AddItem-ID –ListItemID(Last) selected item ID ( List + ListItem / ListIndex + ListItemID) ( RowSourceType (0=None), (1=Value) )

41 ID-Methods Combo box n AddItemAdd at position n AddListItemAdd with ID n RemoveItemRemove from position n RemoveListItemRemove with ID n ClearDelete all items n IndexToItemIDPosition -> ID n ItemIDToIndexID -> Position

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

43 Container n FrameSet n Frame n PageFrame n Page n Grid n Column n Option Group n Command Grid, Header, Option Command Buttons Hierarchy

44 Option/Command Button Groups --- AddObject, RemoveObject ButtonCountButtons - ChangeEvents only in Groups - No Inheritance for new buttons n Data n Methods n Layout n Other n Tips

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

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

47 Grids n See: Using the Grid Control - Whil Hentzen

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

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

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

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

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

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

Download ppt "An Introduction to Controls Rainer Becker dFPUG / ISYS GmbH Germany."

Similar presentations

Ads by Google