| |
|
|
| Stephan Sonneborn (01.03.11)
¡Hola zusammen, Yo el Presentación por Thomas todavía algo ergänzt... KompilierenMarcaSeparación'************************************************************************************************
'* Vertikal zentriertes Editfeld Built: 01.03.2011 *
'* optional links, rechts oder mittig ausgerichtet (ggf. nur Zahlen erlaubt) *
'* nach einer Vorlage von Thomas Freier *
'* erweitert durch Stephan Sonneborn *
'************************************************************************************************
DEF GETSYSCOLOR(1) !"USER32","GetSysColor"
'+----------------------------------------------------------------------------------------------+
DECLARE Font&, Edit&, THeight%
DECLARE LastDlgID&
'+----------------------------------------------------------------------------------------------+
'************************************************************************************************
'* Einzel-IDs für Dialogelemete generieren *
'************************************************************************************************
PROC NewID
DECLARE ID&
'+----------------------------------------------------------------------------------------------+
LastDlgID& = LastDlgID& + 1
ID& = LastDlgID&
'+----------------------------------------------------------------------------------------------+
RETURN ID&
'+----------------------------------------------------------------------------------------------+
ENDPROC
'************************************************************************************************
'************************************************************************************************
'* Vertikal zentriertes Editfeld *
'************************************************************************************************
PROC CreateEditVert
PARAMETERS hParent&, Text$, x1%, y1%, dx%, dy%, TSize%, Alignment%, Number%
'hParent : Handle des Elterfensters
'Text$ : Vorgabetext
'x1%, y1% : linke obere Ecke des "Editfeldes"
'dx%, dy% : Größe des "Editfeldes"
'TSize% : Texthöhe im Editfeld
'Alignment%: 0 => links, 1 => mittig, 2 => rechts ausgerichtet
' Number% : <> 0 => nur Zahleneingabe erlaubt
DECLARE hStatic&, hEdit&
DECLARE EHeight%, Style&
'+----------------------------------------------------------------------------------------------+
EHeight% = TSize% + 6
Style& = $50000080 + Alignment%
Case Number%: Style& = Style& + $2000
hStatic& = CONTROL("Static","" ,$54001106 ,x1%,y1%,dx%,dy%,hParent&,NEWID(),0)
hEdit& = CONTROL("Edit" ,Text$, Style&, 0, 0, 0, 0,hStatic&,NewID(),0)
SETWINDOWPOS hEdit& = 0, ((dy%-TSize%)/2) - dx%, EHeight%; 0
'+----------------------------------------------------------------------------------------------+
RETURN hEdit&
'+----------------------------------------------------------------------------------------------+
ENDPROC
'************************************************************************************************
'************************************************************************************************
SET("TRUECOLOR",1)
CLS GETSYSCOLOR(15)
'+----------------------------------------------------------------------------------------------+
THeight% = 30
Font& = CREATEFONT ("Arial",THeight%,0,0,0,0)
Edit& = CreateEditVert(%HWND, "",10,50,300,80,THeight%,1, 0)'Texteingabe
'Edit& = CreateEditVert(%HWND, "",10,50,300,80,THeight%,1, 1) 'Zahleneingabe
SETFONT Edit&, Font&
SETTEXT Edit&,"Bitte hier Text eingeben"
'+----------------------------------------------------------------------------------------------+
LOCATE 1,1
PRINT "Weiter mit F1"
'+----------------------------------------------------------------------------------------------+
WHILE 1
WAITINPUT
CASE %KEY = 5: BREAK
WEND
'+----------------------------------------------------------------------------------------------+
PRINT "Text im Editfeld: ", GETTEXT$(Edit&)
PRINT "Ende mit Mausklick."
'+----------------------------------------------------------------------------------------------+
WAITINPUT
'+----------------------------------------------------------------------------------------------+
DELETEOBJECT Font&
END
'*************** ***************************************************************************
|
|
|
| |
|
|