Forum | | | | - Page 1 - |
|  Stephan Sonneborn | Hello together,
there a Possibility, one Edit too Mouse and Sprite center (too supra and under) auszurichten, as it z.B. with of/ one Excel-cell goes?
Horizontal goes so:
DEF CreateEditC(6) CONTROL("EDIT" ,@$(2),$50000001,@%(3),@%(4),@%(5),@%(6),@%(1),106, %HInstance, $0200)
|
| | | Schöne Grüße aus Wittgenstein von Stephan
Programmierumgebung:| XProfan X4 | WIN10 | AMD FX6100 3,3 GHz | 02/27/11 ▲ |
| |
|  | « this Posting watts as Solution marked. » | |  Thomas Freier | Well, if the Font not adjustable is goes it without plenty Rechnerei.
DEF GETSYSCOLOR(1) !"USER32","GetSysColor"
SET("TRUECOLOR",1)
CLS GETSYSCOLOR(15)
var hWnd&=%hwnd
Var Font1&=CreateButton(%hwnd,"Font-H = 12",400,40,100,30)
Var Font2&=CreateButton(%hwnd,"Font-H = 16",400,80,100,30)
Var Font3&=CreateButton(%hwnd,"Font-H = 22",400,120,100,30)
var Hdlg&=control("Static","",$54000106,10,50,300,80,%hwnd,5000,0)
var Edit&=control("Edit","",$50000005,0,0,0,0,Hdlg&,5000,0)
settext Edit&,"Bitte here Text eingeben"
Declare Edi_Font&
SET_EDIT 16,32
while 1
WaitInput
case %key=2:BREAK
case @Clicked(Font1&): SET_EDIT 12,36
case @Clicked(Font2&): SET_EDIT 16,32
case @Clicked(Font3&): SET_EDIT 22,28
wend
DeleteObject edi_Font&
end
Proc SET_EDIT
Parameters x%,y%
Edi_Font& = CreateFont("Arial",x%,0,0,0,0)
SetFont Edit&,edi_Font&
SetWindowPos Edit&=0,y% - 300,x%+6;0
ENDPROC
|
| | | Gruß Thomas Windows XP SP2, XProfan X2 | 02/28/11 ▲ |
| |  |
| |  | Hello Stephan,
M$ bid the imho self not directly on -
I could one "CanvasEditControl" produce/ offer the "wie too always geartete" properties own can but I would probably first next week moreover come. |
| | | | |
| |  Stephan Sonneborn | Hello iF,
no Pronlem. Schade, that MS not vorgesehen has, with Statics Have ichs hinbekommen,,,
I Have me with the Canvas-Topic not yet engage, what stick because behind it? |
| | | Schöne Grüße aus Wittgenstein von Stephan
Programmierumgebung:| XProfan X4 | WIN10 | AMD FX6100 3,3 GHz | 02/27/11 ▲ |
| |
| |  | | | | | |
| |  E.T. | only so as thought: The Höhe the Edit's the verwendeten Font-Höhe adjust (or inverse: the level the Edits read and the Font-Höhe adjust) ... 
was only so one thought....  |
| | | Grüße aus Sachsen... Mario WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte... | 02/28/11 ▲ |
| |
| |  Thomas Freier | Well, if the Font not adjustable is goes it without plenty Rechnerei.
DEF GETSYSCOLOR(1) !"USER32","GetSysColor"
SET("TRUECOLOR",1)
CLS GETSYSCOLOR(15)
var hWnd&=%hwnd
Var Font1&=CreateButton(%hwnd,"Font-H = 12",400,40,100,30)
Var Font2&=CreateButton(%hwnd,"Font-H = 16",400,80,100,30)
Var Font3&=CreateButton(%hwnd,"Font-H = 22",400,120,100,30)
var Hdlg&=control("Static","",$54000106,10,50,300,80,%hwnd,5000,0)
var Edit&=control("Edit","",$50000005,0,0,0,0,Hdlg&,5000,0)
settext Edit&,"Bitte here Text eingeben"
Declare Edi_Font&
SET_EDIT 16,32
while 1
WaitInput
case %key=2:BREAK
case @Clicked(Font1&): SET_EDIT 12,36
case @Clicked(Font2&): SET_EDIT 16,32
case @Clicked(Font3&): SET_EDIT 22,28
wend
DeleteObject edi_Font&
end
Proc SET_EDIT
Parameters x%,y%
Edi_Font& = CreateFont("Arial",x%,0,0,0,0)
SetFont Edit&,edi_Font&
SetWindowPos Edit&=0,y% - 300,x%+6;0
ENDPROC
|
| | | Gruß Thomas Windows XP SP2, XProfan X2 | 02/28/11 ▲ |
| |
| |  | time testing...
Cls
Var edit& = Create("Edit", %hWnd, "Testtest", 10, 10, 200, 30)
Var edit2& = Control("EDIT", "TestTest", $54040000, 10, 50, 200, 30, %hwnd, 2001, %hInstance, $00020000)
While 1
WaitInput
Case %key=2: BREAK
EndWhile
|
| | | | |
| |  Thomas Freier | The Text is in both Make supra left. have another old Fontauswahl installed, with the of 12 To 28 px Fonthöhe everything To 90% center is. anyway with my system.
$H windows.ph
DEF GETSYSCOLOR(1) !"USER32","GetSysColor"
Def GetTextExtentPoint32(4) !"GDI32","GetTextExtentPoint32A"
Def ReleaseDC(2) !"USER32","ReleaseDC"
Def ApiChooseFont(1) ! "COMDLG32.DLL","ChooseFontA","#","%"
SET("TRUECOLOR",1)
CLS GETSYSCOLOR(15)
var hWnd&=%hwnd
Var Font1&=CreateButton(%hwnd,"Font",400,40,100,30)
var Hdlg&=control("Static","",$54000106,10,50,300,80,%hwnd,5000,0)
var Edit&=control("Edit","",$50000005,0,0,0,0,Hdlg&,5000,0)
settext Edit&,"Bitte here Text eingeben"
Declare Edi_Font&
var Font$="Arial"
var hoehe%=16
var Big%=0
var Italic%=0
var Underline%=0
SET_EDIT
while 1
WaitInput
case %key=2:BREAK
If @Clicked(Font1&)
case big%=1 : big%=500
LR_Font_Wahl Font$,(hoehe%*122),Big%, Italic%
SET_EDIT
EndIf
wend
DeleteObject edi_Font&
end
Proc SET_EDIT
Edi_Font& = CreateFont(Font$,hoehe%,0,Big%,Italic%,Underline%)
SetFont Edit&,edi_Font&
O_GetTextExtent GetText$(edit&),1'length
var StringBreite& = &(0)
O_GetTextExtent GetText$(edit&),0'Höhe
var StringHoehe& = &(0)
var x!=hoehe%/10
SetWindowPos Edit&=0,22+(StringHoehe&/x!) - 300,(StringHoehe&+(x!*6));0
ENDPROC
Proc O_GetTextExtent
Parameters _t$,_w%
declare _size#,_text#,_result&,_hdc&
dim _text#,Len(_t $) + 1
dim _size#,8
String _text#,0 = _t$
_hdc& = ~GetDC(hWnd&)
GetTextExtentPoint32(_hdc&,_text#,Len(_t $),_size#)
_result& = Long(_size#,4)
Case _w% : _result& = Long(_size#,0)
ReleaseDC(hWnd&,_hdc&)
dispose _text#
dispose _size#
return _result&
ENDPROC
Proc LR_Font_Wahl
Parameters nFont$,nhoehe%,nFett%,nkurs%
Declare logfont#, choosefont#
dim logfont#,80'-> must tall enough his, there otherwise the NAME gekürzt becomes !
Long logfont#,0=(nhoehe%/90)'FONTHeight 1000 corresponds to 10
Long logfont#,4=20'FONTWidth 1000 corresponds to 10
Long logfont#,8=0'
Long logfont#,12=200'FONTOrientation
Long logfont#,16=nFett%'FONTWeight - To 400 is normal, everything drüber means big !
String logfont#,20=@Chr$(nkurs%)'Italic
String logfont#,21=@Chr$(Underline%)'Underline
String logfont#,22=""'StrikeOut
String logfont#,23="0"'CharSet
String logfont#,24="T"'OutPrecision
String logfont#,25="T"'ClipPrecision
String logfont#,26="0"'Quality
String logfont#,27="2"'PitchAndFamily
String logfont#,28=nFont$'FaceName
Dim choosefont#,60
Long choosefont#,0 = 60'length the Strukturvariable
Long choosefont#,4 = %hwnd'lever the Mainwindow
Long choosefont#,8 = 0'Instance-lever the Mainwindow
Long choosefont#,12= logfont#'LogFontStruktur
Long choosefont#,16 = 0'Pointsize
Long choosefont#,20 = $00002341'? Happen?
Long choosefont#,24 = rgb(0,0,0)'RGB - Default-Settings and worth the read becomes
Long choosefont#,28 = 0'Custdata
Long choosefont#,32 = 0'Hook
long choosefont#,36= 0'Templatename
Long choosefont#,40= 0'Hinstance
long choosefont#,44= 0'Lpszstyle
Long choosefont#,48= $00000001'FONTtype
Long choosefont#,52= 8'FONTSizeMin
Long choosefont#,56= 36'FONTSizeMax
Decimals 0
apichoosefont(choosefont#)
if @Long(choosefont#,16)/10 > 0' if Size = 0 aborted
'colour read
'Print @GetRValue(@long(choosefont#,24)),\
' @GetGValue(@long(choosefont#,24)),\
' @GetBValue(@long(choosefont#,24))," <- Textfarbe RGB"
'attributes read
Hoehe%=(@word(choosefont#,16)/10)
Font$=@string $(logfont#,28)
Italic%=@Ord(@string $(logfont#,20))
Underline%=@Ord(@string $(logfont#,21))
Big%=@Long(logfont#,16)
if Big% > 400
Big%=1
else
Big%=0
endif
endif
Dispose logfont#
Dispose choosefont#
ENDPROC
|
| | | Gruß Thomas Windows XP SP2, XProfan X2 | 02/28/11 ▲ |
| |
| |  Stephan Sonneborn | Thomas suitor (28.02.11)
Well, if the Font not adjustable is goes it without plenty Rechnerei.
Hi Thomas,
working lovely!  The Font becomes only once programmtechnisch tuned and remaining then unveränderlich.
Vielen Thanks!!! |
| | | Schöne Grüße aus Wittgenstein von Stephan
Programmierumgebung:| XProfan X4 | WIN10 | AMD FX6100 3,3 GHz | 02/28/11 ▲ |
| |
| |  Stephan Sonneborn | Hello together,
I The Presentation Thomas yet something complement...
'************************************************************************************************
'* Vertikal zentriertes Editfeld Built: 01.03.2011 *
'* optional left, right or center reported (ggf. only numbers allows) *
'* after a Presentation Thomas suitor *
'* extended through Stephan Sonneborn *
'************************************************************************************************
DEF GETSYSCOLOR(1) !"USER32","GetSysColor"
'+----------------------------------------------------------------------------------------------+
DECLARE Font&, Edit&, THeight%
DECLARE LastDlgID&
'+----------------------------------------------------------------------------------------------+
'************************************************************************************************
'* single-IDs for Dialogelemete Generate *
'************************************************************************************************
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 : lever the Elterfensters
'Text$ : Vorgabetext
'x1%, y1% : left upper corner the "Editfeldes"
'dx%, dy% : Size the "Editfeldes"
'TSize% : Texthöhe in the Editfeld
'Alignment%: 0 => left, 1 => center, 2 => right reported
' Number% : <> 0 => only Zahleneingabe allows
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)'Text-Input
'Edit& = CreateEditVert(%HWND, "",10,50,300,80,THeight%,1, 1) 'Zahleneingabe
SETFONT Edit&, Font&
SETTEXT Edit&,"Bitte here Text eingeben"
'+----------------------------------------------------------------------------------------------+
LOCATE 1,1
PRINT "Weiter with F1"
'+----------------------------------------------------------------------------------------------+
WHILE 1
WAITINPUT
CASE %KEY = 5: BREAK
WEND
'+----------------------------------------------------------------------------------------------+
PRINT "Text in the Editfeld: ", GETTEXT$(Edit&)
PRINT "Ende with Click."
'+----------------------------------------------------------------------------------------------+
WAITINPUT
'+----------------------------------------------------------------------------------------------+
DELETEOBJECT Font&
END
'************************************************************************************************
|
| | | Schöne Grüße aus Wittgenstein von Stephan
Programmierumgebung:| XProfan X4 | WIN10 | AMD FX6100 3,3 GHz | 03/01/11 ▲ |
| |
| |  Thomas Freier | and another reduziertes example with "Blinden Edit-Feldern", that I use circa "Namensschilder" on one Bootsplatz(here without Hintergrundgrafik) anzulegen, To edit and To move.
DEF GetSysColor(1) !"USER32","GetSysColor"
Def APISetCursorPos(2) ! "USER32","SetCursorPos"
Def WindowFromPoint(2)!"USER32","WindowFromPoint"
Def GetCursorPos(1) !"USER32","GetCursorPos"
Declare p#,h&
Dim p#,8
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Def GetTextExtentPoint32(4) !"GDI32","GetTextExtentPoint32A"
Def ReleaseDC(2) !"USER32","ReleaseDC"
Def GetDC(1) !"USER32","GetDC"
declare x%,y%
Proc GetTextExtent
Parameters _t$,_w%
declare _size#,_text#,_result&,_hdc&
dim _text#,Len(_t $) + 1
dim _size#,8
String _text#,0 = _t$
_hdc& = GetDC(GetActiveWindow())
GetTextExtentPoint32(_hdc&,_text#,Len(_t $),_size#)
_result& = Long(_size#,4)
Case _w% : _result& = Long(_size#,0)
ReleaseDC(GetActiveWindow(),_hdc&)
dispose _text#
dispose _size#
return _result&
ENDPROC
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Def @Clienttoscreen(2) !"USER32","ClientToScreen"
Def @G2lx(0) @Long(C2sstrc#,0)
Def @G2ly(0) @Long(C2sstrc#,4)
Proc G2l
Parameters Hdl&
Clear C2sstrc#
@Clienttoscreen(%Hwnd,C2sstrc#)
x%=@G2lx()
y%=@G2ly()
Clear C2sstrc#
@Clienttoscreen(Hdl&,C2sstrc#)
x%=@G2lx()-x%
y%=@G2ly()-y%
Endproc
Declare C2sstrc#
Dim C2sstrc#,8
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SubClassProc
case SubClassMessage(h&, $201): PostMessage(h&, $A1, $2, 0)
Endproc
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Window 1000,600
Window Title "Blindes Edit-area, to Double click left verschiebbar, to Rechtsklick" + \
" editierbar - Linksklick in the Window = take, Rechtsklick in the Window = new Edit"
UseFont "Arial",16,0,0,0,0
CLS GETSYSCOLOR(15)
var LV_Font&=CreateFont("Arial",15,0,0,0,0)
SETDIALOGFONT LV_Font&
Declare b.obj&[],b.x%[],b.x1%[],b.y%[],b.y1%[], b.Text$[],b.site$[]
Declare b.xn%
Declare pic1&
b.xn%=1
b.x%[b.xn%]=400
b.y%[b.xn%]=320
b.Text$[b.xn%]="K. Mustermann"
b.site$[b.xn%]="S"
Boot_obj b.xn%
Subclass b.obj&[b.xn%],1
b.xn%=2
b.x%[b.xn%]=428
b.y%[b.xn%]=320
b.Text$[b.xn%]="E. Wassermann"
b.site$[b.xn%]="S"
Boot_obj b.xn%
Subclass b.obj&[b.xn%],1
b.xn%=3
b.x%[b.xn%]=200
b.y%[b.xn%]=200
b.Text$[b.xn%]="K. Mustermann"
b.site$[b.xn%]="W"
Boot_obj b.xn%
Subclass b.obj&[b.xn%],1
b.xn%=4
b.x%[b.xn%]=200
b.y%[b.xn%]=228
b.Text$[b.xn%]="E. Wassermann"
b.site$[b.xn%]="W"
Boot_obj b.xn%
Subclass b.obj&[b.xn%],1
b.xn%=4
While 1
WaitInput
Case %key=2:Break
Whileloop b.xn%
G2l b.obj&[&loop]
b.x%[&loop]=x%
b.y%[&loop]=y%
EndWhile
GetCursorPos(p#)
h&=WindowFromPoint(Long(p#,0),Long(p#,4))
if %MouseKey=2' unless moved go should: %MouseKey=1
x%=1
Whileloop b.xn%' Number of Objects
if Mouse(b.x%[&loop],b.y%[&loop] - (b.x%[&loop]+b.x1%[&loop]),(b.y%[&loop]+b.y1%[&loop]))
ShowWindow(b.obj&[&loop],0)
Element_Edit &loop' EDIT-area vorhandenes Objekt
Subclass b.obj&[&loop],1
x%=0
break
endif
wend
if x%=1
inc b.xn%
b.x%[b.xn%]=%MouseX
b.y%[b.xn%]=%MouseY
b.Text$[b.xn%]=""
b.site$[b.xn%]="W"
b.x1%[b.xn%]=120
Element_Edit b.xn%' EDIT-area new Objekt
Subclass b.obj&[b.xn%],1
endif
SetFocus(%HWND)
endif
EndWhile
DeleteObject LV_Font&
DeleteObject pic1&
Whileloop b.xn%
Subclass b.obj&[&loop],0
EndWhile
Dispose C2sstrc#
Dispose p#
End
Proc Boot_obj
Parameters b.xi%
UseFont "Arial",(16+2),0,0,0,0
GetTextExtent b.Text$[b.xi%],1'Text Length
b.x1%[b.xi%] = &(0)+0'length
GetTextExtent b.Text$[b.xi%],0
b.y1%[b.xi%] = &(0)+4'Höhe
If trim$(b.site$[b.xi%]="S")'length+Höhe swap with vertically
x%=b.y1%[b.xi%]
b.y1%[b.xi%]=b.x1%[b.xi%]
b.x1%[b.xi%]=x%
endif
MCls b.x1%[b.xi%], b.y1%[b.xi%] ,RGB(255,255,255)
StartPaint -1
USEP 0, 1, @RGB(192, 192, 192)
Rectangle 0,0-b.x1%[b.xi%], b.y1%[b.xi%]
Text Color @RGB(0,0,0), -1
If trim$(b.site$[b.xi%]="W")
Set("Orientation", 0)
UseFont "Arial",16,0,0,0,0
DrawText 2, 2, b.Text$[b.xi%]
ElseIf trim$(b.site$[b.xi%]="S")
Set("Orientation", 2700)
UseFont "Arial",(16-1),0,0,0,0
DrawText b.x1%[b.xi%]-2, 2, b.Text$[b.xi%]
Endif
Endpaint
Set("Orientation", 0)
pic1&=Create("HPIC",0,"&MEMBMP" )
b.obj&[b.xi%]=Control("DIALOG","",$54001100,b.x%[b.xi%], b.y%[b.xi%], b.x1%[b.xi%], b.y1%[b.xi%],%hwnd,0,%hinstance,$0)
Create("Bitmap",b.obj&[b.xi%], pic1&,0, 0)
Endproc
Proc Element_Edit
Parameters b.xi%
var edi.x%= b.x1%[b.xi%]
case b.site$[b.xi%]="S" : edi.x%= b.y1%[b.xi%]
var Element&= CreateEdit(%hwnd,b.Text$[b.xi%],b.x%[b.xi%], b.y%[b.xi%],120 , 22)
SetFont Element&,LV_Font&
var element1&=Create("GroupBox",%hwnd,"",b.x%[b.xi%], (b.y%[b.xi%]-38),120,30)
CreateText(element1&,"",2,10,116,18)
var hor&=Create("RadioButton",%hwnd,"",(b.x%[b.xi%]+4),(b.y%[b.xi%]-25),12,12)
var t1&=CreateText(element1&,"0°",18,11,14,16)
var sen&=Create("RadioButton",%hwnd,"",(b.x%[b.xi%]+38),(b.y%[b.xi%]-25),12,12)
var t2&=CreateText(element1&,"90°",56,11,22,16)
var t3&=Create("Button",element1&,"F",90,10,18,18)
@Create("Tooltip",%hwnd,t3&,"Font wählen")
SetFont hor&,LV_Font&
SetFont t1&,LV_Font&
SetFont t2&,LV_Font&
SetFont t3&,LV_Font&
If trim$(b.site$[b.xi%]="W")
SetCheck hor&,1
else
SetCheck sen&,1
EndIf
SendString(Element&,"+({END})")'Text Mark and Cursor ans end
While 1
WaitInput
If GetFocus(%hwnd)
b.Text$[b.xi%] = GetText$(Element&)
If GetCheck(hor&)
b.site$[b.xi%]="W"
Else
b.site$[b.xi%]="S"
EndIf
BREAK
endif
wend
DestroyWindow(Element&)
DestroyWindow(element1&)
DestroyWindow(hor&)
DestroyWindow(sen&)
Boot_obj b.xi%' Textobjekt new
ENDPROC
|
| | | Gruß Thomas Windows XP SP2, XProfan X2 | 03/02/11 ▲ |
| |
|
AnswerTopic-Options | 13.734 Views |
Themeninformationenthis Topic has 5 subscriber: |