Steuerelemente unter Visual FoxPro - dFPUG

Download Report

Transcript Steuerelemente unter Visual FoxPro - dFPUG

Steuerelemente
Visuelle Steuerelemente in
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Diese Schulung dient der Einführung in
das Arbeiten mit Steuerelementen und
der wichtigen Eigenschaften und
Methoden von Steuerelementen unter
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Themenübersicht
 Einführung Steuerelemente
 Unsichtbare Steuerelemente
 Sichtbare Steuerelemente
 Shapes, Images und Labels
 Anwählbare Steuerelemente
 List- und Comboboxen
 Container
 Sonderfälle
 Namenskonventionen
Wizards &
Builders GmbH
Einführung Steuerelemente
Übersicht und Einführung zu
Steuerelementen unter
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Steuerelemente









Timer
Linie
Shape
Image
Label
Command Button
Option Button
Check Box
Text Box









Edit Box
Spinner
Option Group
Command Group
Combo Box
List Box
Page Frame (Page)
Grid (Header/Column)
OLE-Control
Wizards &
Builders GmbH
Umbenannte Controls







Text
=> Label control
GET-Field
=> Textbox
Edit Region
=> Editbox
Popup
=> Combobox
Radio button => Optionbutton
Screen (Set)
=> Form (Set)
Picture
=> Image
Wizards &
Builders GmbH
Neue Steuerelemente







Timer
Pageframe (Page)
Grid (Header, Column)
Toolbar (Separator)
Project Hook
Hyperlink
Active Document
Wizards &
Builders GmbH
Unsichtbare Steuerelemente
Eigenschaften und Methoden von
unsichtbaren Steuerelementen unter
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Timer





Daten
Methods
Layout
Other

Tips





Comment, Tag
BASIC, TimerEvent, Reset
COORDINATES
CLASS, Interval
- Not executed while Menu
open
- Not exact enough for
RealTime
Wizards &
Builders GmbH
Timer & Basis Daten/Layout

Timer
 TimerEvent
 ResetMethod
 IntervalProperty

Daten
 Comment
 Tag

Aufgerufene Prozedur
Timer neu starten
Timer in Millisekunden
Sollte man ggf. verwenden...
Freie Eigenschaft
Layout
 Top, Left, Heigth, Width Koordinaten
Wizards &
Builders GmbH
Basis Andere

Andere
 Name
Namenskonventionen!
 Enabled
logischer Schalter
 Class
Klassenzugehörigkeit
 ClassLibrary ggf. VCX der Klasse
 Baseclass
Basisklasse (abgeleitet von)
 Parentclass ggf. Parent-Klasse (dito)
 Parent Container/Parent(Laufzeit!)
Wizards &
Builders GmbH
Basis-Ereignisse/Methoden

Events
 Init
 Destroy
 Error

Initialisierung Objekt
Beseitigung Objekt
Lokale Fehlerbehandlung!
Methoden
 CloneObject “runtime duplication”
 SaveAsClass In andere VCX speichern
 Read/WriteExpression/Method Design
Wizards &
Builders GmbH
Sichtbare Steuerelemente
Eigenschaften und Methoden von
sichtbaren Steuerelementen unter
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Linien


Daten
Events
---
 CLICK, MOUSE, DRAG

Methoden
 Drag, Move, UIEnable, ZOrder

Layout
 DragIcon/Mode, BORDER,Draw-Mode, MousePointer, LineSlant


Andere
Tips
HelpContextID
- No 3D-line-effects
Wizards &
Builders GmbH
Klick- & Maus-Ereignisse

Click
 Click
 DblClick
 RightClick

Mouse left click
Mouse double click
Mouse right click
Mouse
 MouseMove
 MouseDown
 MouseUp
 MousePointer
Mouse over object
Mouse pressed for click
Mouse released
12 pointer versions
Wizards &
Builders GmbH
Drag & Drop

Drag
 DragDrop
 DragOver

Methods
 Drag
 Move

End of drag, target event
object over target, target event
Method for manual dragging
Method for manual moving
Properties
 DragIcon
 DragMode
Cursor Icon for drag
automatic / manual
Wizards &
Builders GmbH
Eigenschaften






Bordercolor, -style, -width Rahmen
Visible
Logischer Schalter
HelpContextID
für Hilfe-Compiler
ZOrder Meth.
active Page, tlb order
UIEnable Evt. Page activate event
Drawmode
16 verschiedene Modes
(Line/Shape/Form)

LineSlant
Sondereigenschaft
Wizards &
Builders GmbH
Shapes, Images und Label
Eigenschaften und Methoden von
flachen Steuerelementen unter
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Shapes



Daten
Methoden
Layout
-----
 BackColor/Style, FillColor/Style, ColorScheme/Source,
ToolTip, SpecialEffect, Curvature


Andere
Tips
---
 Shapes in front block the click event
Wizards &
Builders GmbH
Eigenschaften (flache Obj.)

Colors
 BackStyle
 BackColor
 FillColorStyle
 FillColor
 ColorScheme
 ColorSource



Transparent / Opaque (Default)
RGB-Color for Qpaque objects
Transparent, Solid, Lines
RGB-Color if not transparent
Object/Form/Source/Default
Scheme for Above=Source
ToolTipText
ToolTip if Form.ShowTips=.T.
SpecialEffect Plain or 3D
Curvature
0=rectangle - 99=circle
Wizards &
Builders GmbH
Images
Daten
 Methoden
 Layout

-----
 Picture (Bitmap, Icon), Stretch
(Clip/Isometric/Stretch)
Andere
-- Tips
Stretch also used for OLE

Wizards &
Builders GmbH
Labels
Daten
 Methoden
 Layout

-----
 Caption, FONT, COLOR, AutoSize, WordWrap,
Alignment
Andere
-- Tips
Caption can be function

Wizards &
Builders GmbH
Layout-Eigenschaften (Captions)


FontName & FontSize
FontFlags
FontBold, FontItalic, FontStrikeThru,
FontOutline, FontUnderline, FontShadow





Color
Caption
Alignment
AutoSize
WordWrap
DisabledBackColor, (Disabled)ForeColor
Text to be shown (function)
Left/Right/Centered
Resize horiz. for text
Wrap words/resize vertical
Wizards &
Builders GmbH
Anwählbare Steuerlemente
Eigenschaften und Methoden von
anwählbaren Steuerelementen unter
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Command Buttons



Daten
Methoden
Layout
TerminateRead
ErrorMessage, EVENTS
 DownPicture, DisabledPicture, StatusBarText, (Style=Inv.)

Andere
 TabIndex, TabStop (Forms!) , Default, Cancel

Tips
 Use small fonts with pictures
 Use StatusBarText instead
Wizards &
Builders GmbH
Ereignisse (zugreifbare Obj.)








When
Valid
GotFocus
LostFocus
SetFocus
KeyPress
Refresh
Message
old-fashioned WHEN
old-fashioned VALID
Tabbed to it
Tabbed somewhere else...
Method (enabled & visible)
Key Preview Event
SHOW GET (Requery,Page)
Return Message text (Old!)
Wizards &
Builders GmbH
Option Buttons

Daten
 ControlSource
Field or memvar
 Value same type as the ControlSource

Layout
 Alignment (Left/Right) for button
 SpecialEffect not for command button
Andere -- Tips
Nur in Option Button Groups!

Wizards &
Builders GmbH
Konfusion?
 Name
Objektname
 Caption
Titel
 ControlSource Datenquelle
 memvar
 field
 function
 Value
Objektwert
Wizards &
Builders GmbH
Check Boxen


Daten
Methoden
---
 InteractiveChangeEvent, ProgrammaticChangeEvent



Layout
Andere
Tips
-----
 ProgrammaticChange important!
Wizards &
Builders GmbH
Textboxen

Daten
 Format, InputMask, Margin, Read-Only,
Open/MemoWindow

Methoden
 RangeHigh, RangeLow

Layout
 SELECT, Style (SAY-compatible), PasswordChar,


Andere HideSelection
Tips
Play with selected areas!
Wizards &
Builders GmbH
Selektierter Text






SelStart
Begin of selection
SelLength
Number of chars
SelText
Selected text
HideSelection
Show LostFocus
SelectedForeColor Text color
SelectedBackColor Background color
Wizards &
Builders GmbH
Editboxen
Daten
 Methoden
 Layout

MaxLength
---
 ScrollBars (vert. & horiz.)
Andere
 Tips

AllowTabs
“Selected text”
Wizards &
Builders GmbH
Spinner

Daten
 KeyboardHigh/LowValue
 SpinnerHigh/LowValue
 Increment

Methoden
Layout
Andere
UpEvent, DownEvent
-----

Tips
Use High/LowValues instead of


RangeEvents
Wizards &
Builders GmbH
List- und Comboboxen
Eigenschaften und Methoden von
List- und Comboboxen unter
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Combo-Boxen



Daten
BoundColumn,
DisplayValue
Methoden
AddItem, AddListItem,
Layout
 ColumnCount, -Lines, -Width,
Disabled/Select/Item/Back/ForeC

Other
 TopIndex, TopItemID, +NEW, IncrementalSearch,
Listcount

Tips
ListIndex, ListIdemID
Wizards &
Builders GmbH
Layout (Combobox)






ColumnCount
Anzahl Spalten
ColumnLines
Anzeigen Linien
ColumnWidth
Breite der
Spalten
(colondelimited)
ItemBack/ForeColor
SelectedItemBack/ForeColor
DisabledItemBack/ForeColor
Wizards &
Builders GmbH
Daten (Combobox)








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
Wizards &
Builders GmbH
Methoden/Sonstiges (Combobox)

Methods
 Requery

Requery SQL/QPR-Source
Other
 IncrementalSearch self-explanatory
 TopIndex
 NewIndex
 Listcount
 ListIndex
first visible item
last AddItem-position
Number of items
(Last) selected item
Wizards &
Builders GmbH
Was sind Ids (Combobox) ?
ItemIDData
 ListItem
 Other

Additional value by ID
Array of text by ID
 TopItemID
 NewItemID
 ListItemID
ID of topmost vis. list-item
last AddItem-ID
(Last) selected item ID
( List + ListItem / ListIndex + ListItemID)
( RowSourceType (0=None), (1=Value) )
Wizards &
Builders GmbH
ID-Methoden (Combobox)







AddItem
AddListItem
RemoveItem
RemoveListItem
Clear
IndexToItemID
ItemIDToIndex
Add at position
Add with ID
Remove from pos.
Remove with ID
Delete all items
Position -> ID
ID -> Position
Wizards &
Builders GmbH
Listboxen
Daten
 Methoden
 Layout
 Andere
 Tips

------MultiSelect
 Use DisplayValue and Value together for text
and offset
Wizards &
Builders GmbH
Container
Eigenschaften und Methoden von
Containern unter
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Was sind Container?


Objekte können
wiederum aus
Objekten bestehen
Ein Objekt mit
„Childs“ heißt
„Container“
Wizards &
Builders GmbH
Container Hierarchie








FrameSet
Frame
PageFrame
Page
Grid
Column
Option Group
Command Group








Frame
PageF,Grid,Ctrls
Page
Grid, Controls
Column
Header, Controls
Option Buttons
Command Buttons
Wizards &
Builders GmbH
Option/Command Groups
Daten
 Methoden
 Layout
 Andere
 Tips

--AddObject, RemoveObject
ButtonCount
Buttons
 ChangeEvents only in Groups
 No Inheritance for new buttons
Wizards &
Builders GmbH
PageFrames
Daten
 Methoden
 Layout

ActivePage
---
 PageCount, PageHeight/Width, Tabs, TabStretch
Andere
 Tips

Pages (Array)
 Drop objects on top for all pages
Wizards &
Builders GmbH
Pages
Daten
Controls (Array)
 Methoden
-- Layout ControlCount
 Andere
PageOrder, KeyPreview
 Tips
Reference all with PAGES

Wizards &
Builders GmbH
Grids
Ersatz/Ergänzung für BROWSE
 Sehr komplexes Objekt

 Header
 Columns
 beliebige Steuerelemente (incl. Grids!)
 separater Thread in der Steuerung
 Dynamic-Eigenschaften

Siehe separater Vortrag
Wizards &
Builders GmbH
OLE-Controls

OLE Bound Controls
 "bound" to General-fields
 keine Ereignisse

OLE Container Controls
PicClip, Outline,
WinWord, O-Gramm,
Graph, Excel, Comm,
ClipArt, PowerPoint,
Formel-Editor
 OCX with own Events
 OLE unbound to fields
Siehe auch:
OLE Custom Controls / OLE-Automation
Wizards &
Builders GmbH
Container-Konfusion

Container Objects
 FrameSet, Frame, PageFrame, Page, Grid,
Column, Option Group, Command Group

Control Objects
 protected

Custom Objects
 non-visual
Wizards &
Builders GmbH
Sonderfälle
Spezielle Steuerelemente und Ihre
Methoden / Eigenschaften unter
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Toolbars / Separators





Sonderobjekt für die Menüsteuerung
Variante einer Maske
Enthält beliebige Objekte (Container)
Sonderobjekt „Separator“ für Trennung
von Buttons voneinander
Probleme mit Separator bei Subclass!
Wizards &
Builders GmbH
Sonderfall Project Hook

Sonderobjekt für die Projektsteuerung

Eigenschaften
 OLEDropEffects, OLEDropMode, OLEDropHasData

Methoden
 OLEDragDrop, OLEDragOver
 AfterBuild, BeforeBuild
 QueryAddFile, QueryRemoveFile, QueryRunFile,
QueryModifyFile
Wizards &
Builders GmbH
Sonderfall Hypertext

Sonderobjekt für die Browser-Steuerung
Einsetzbar nur mit Internet Explorer

Methoden:

 GoBack
 GoForward
 NavigateTo

Vereinfacht Einbindung von Hyperlinks
Wizards &
Builders GmbH
Sonderfall Active Document
Sonderobjekt für die
Objektsteuerung
 Ereignisse

 EnterFocus, ExitFocus
 HideDoc, ShowDoc
 Run, ContainerRelease
 CommandTargetExec, CommandTargetQuery
Wizards &
Builders GmbH
Namenskonventionen
Namenskonventionen für
Steuerelemente unter
Microsoft Visual FoxPro
Wizards &
Builders GmbH
Namenskonventionen (1)










chk
cbo
cmd
cmg
cnt
ctl
(cus
edt
frm
frs
Check box
Combo box
Command
Com. group
Container
Control
Custom)
Edit box
Form
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
Wizards &
Builders GmbH
Namenskonventionen (2)










opg
(otl
pag
pgf
sep
shp
spn
txt
tmr
tbr
Option group
Outline)
Page
Page Frame
Separator
Shape
Spinner
Text box
Timer
Toolbar
Neu:



Hyperlink
Projekt
Active Document
Wizards &
Builders GmbH
Builder







Textbox
Editbox
Listbox
Combo-Box
Option Group
Command Group
Grid

Design-Only Methods
 Read/WriteMethod( )
 Read/WriteExpression( )

Add/RemoveObj( )
ASelObj( )

You will love them!

Wizards &
Builders GmbH
Was ist zu beachten?








Drag & Drap
Ereignissteuerung
Maussteuerung
Selektierter Text
List-/Comboboxen
Container-Klassen
Namenskonvention
Builder selbst?
Wizards &
Builders GmbH
Vielen Dank!
Das waren die Themen:
 Einführung Steuerelemente
 Unsichtbare Steuerelemente
 Sichtbare Steuerelemente
 Shapes, Images und Labels
 Anwählbare Steuerelemente
 List- und Comboboxen
 Container
 Sonderfälle
 Namenskonventionen
Wizards &
Builders GmbH
Wenn Fragen bestehen:
Wizards & Builders
Methodische SoftwareEntwicklung GmbH
Frankfurter Str. 21b
61476 Kronberg
Tel.: 06173-950906
Fax: 06173-950907
CIS: 101605,175
Wizards &
Builders GmbH