vcl

Fix VCL Styles Directory in Delphi XE3

拟墨画扇 提交于 2019-12-06 05:29:31
I have a problem about VCL Styles in Delphi IDE. When I change VCL Style From default style to another style in delphi IDE and run program an "Style 'Style Name' not found" error comes up. I trying to find a option in IDE to fix Style directory, but I can't find any options. Please, help me to solve this problem and fixing IDE Options. thanx a lot. oh, after a time, I found a way for solving this problem. for solving this problem must running the "redistsetup.bat" file. this file by default located in "C:\Program Files\Embarcadero\RAD Studio\10.0\Redist\redistsetup.bat". (^_^) I found I was

Conditionally compile units for FMX or VCL

☆樱花仙子☆ 提交于 2019-12-06 01:27:25
问题 I want to have a different list of units in the uses clause depending on compiling for FMX or VCL. In the code below I try to test FireMonkeyVersion which works in an FMX project ( label1.Text is 'FMX'). When I move the $IF statement into the uses clause I get an error message ( [dcc32 Error] fmx_text.pas(7): E2026 Constant expression expected ). Is there any way to get the desired conditional compilation? unit fmx_text; interface uses System.SysUtils, System.Types, System.UITypes, System

How to print TPanel contents?

跟風遠走 提交于 2019-12-05 22:02:17
I have TPanel. On this Panel there is an TImage descendant , few other panels with controls, etc. In fact, picture contains some diagram, while additional panels with labels are created during runtime to provide user with additional info. Recently I was told, that it would be nice, if it was possible to print this panel, and have it on the paper just as it appears in form. Any clues, how to do it? I found an old usenet post that provides a solution, by copying the contents of the panel to a bitmap, which can be printed: procedure TFormPrintWindows.ButtonPrintPanelClick(Sender: TObject); var

Reduce CPU time spent in VCL

∥☆過路亽.° 提交于 2019-12-05 21:24:39
It is important for a MIDI player to playback the notes as precisely as possible. I never quite succeeded in that, always blaming the timer (see a previous thread: How to prevent hints interrupting a timer ). Recently I acquired ProDelphi and started measuring what exactly consumed that much time. The result was quite surprising, see the example code below. procedure TClip_View.doMove (Sender: TObject; note, time, dure, max_time: Int32); var x: Int32; begin {$IFDEF PROFILE}Profint.ProfStop; Try; Profint.ProfEnter(@self,1572 or $58B20000); {$ENDIF} Image.Picture.Bitmap.Canvas.Pen.Mode := pmNot;

Getting a Delphi TTimer to work with a multi-threading app

回眸只為那壹抹淺笑 提交于 2019-12-05 21:05:37
I have an issue with a simple TTimer that's initiated and have its OnTimer event executed in the main app thread , the code looks like this: procedure TForm1.DoSomeStuff(); begin OmniLock.Acquire; try Parallel.Pipeline.NumTasks(MaxThreads).Stage(StageProc).Run; if (MyTimer = nil) then begin MyTimer := TTimer.Create(nil); MyTimer.Interval := 60 * 1000; // timer fired every 60 seconds MyTimer.OnTimer := MyTimerEvent; MyTimer.Enabled := True; end; finally OmniLock.Release; end; // try/finally end; Everthing work just fine when I execute the code in a simple project/demo, but in my app (which uses

Delphi XE2 VCL styles, remove a style or disable a class skinning from a TLabel

怎甘沉沦 提交于 2019-12-05 16:18:01
Using XE2 VCL styles, I'd like to disable the skinning for TLabel (or property sfTextLabelNormal) I've tried all kind of solutions from other questions, like using Engine.UnRegisterStyleHook, but it has no effect. The TLabel component doesn't use styles hooks because is not a TWinControl descendant, so you can't use the UnRegisterStyleHook function. Instead you must override the Paint DoDrawText method. UPDATE Here you have a sample of how override the paint process of a TLabel. //declare this code in the implementation part uses Vcl.Themes, Vcl.Styles; type TLabelHelper= class helper for

What happened to TBitBtn and TButton inheritance chain?

旧街凉风 提交于 2019-12-05 12:29:58
I've recently began to upgrade my RAD Studio 2007 project to RAD Studio 2009. One thing I noticed is when seemingly simple code all of a sudden failed to compile. Example Code: class CButtonPopupMenu { // Snip public: void Init( TButton* SrcButton ) { SrcButton->OnClick = OnButtonClick; } private: void __fastcall OnButtonClick( TObject* Sender ) { // Do some button click stuff } }; // Snip TButton button = new TButton( this ); TBitBtn bitBtn = new TBitBtn( this ); CButtonPopupMenu popupButton = new CButtonPopupMenu( button ); CButtonPopupMenu popupBitBtn = new CButtonPopupMenu( bitBtn ); This

TPanel does not AutoSize when containing a TPanel

冷暖自知 提交于 2019-12-05 10:33:17
I have a panel inside another: The inner panel is aligned alTop : And the outer panel is set to AutoSize=true : And everything sizes. If i changes the height of the inner panel at design time, the outer panel auto sizes to accommodate it: And now runtime Now i need to change the height of the inner panel at runtime : procedure TForm2.Button1Click(Sender: TObject); begin pnlInner.Height := pnlInner.Height + 50; lblPointer.Top := pnlOuter.Top + pnlInner.Height; end; Except when i change the height of the inner panel at runtime , the autosize panel does not autosize : This of course worked in

How do I do a proper owner-draw of Full Row Selected TDBGrid when TDBGrid.DefaultDrawing is false?

社会主义新天地 提交于 2019-12-05 07:46:57
When you have a TDBGrid, full row selection, and always show selection, even when not focused, and you want to fully owner-draw it, you have a choice of a deprecated event OnDrawDataCell , and a new event DrawColumnCell , I chose the latter and try this: procedure TDbGridTestForm.mygridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if gdSelected in State then begin // mygrid.DrawCellHighlight(Rect, State, Col, Row); mygrid.Canvas.Brush.Color := clHighlight; mygrid.Canvas.Font.Color := clHighlightText; mygrid.Canvas.FillRect

Can a TEdit show color emoji?

隐身守侯 提交于 2019-12-05 06:46:38
I'd like to see emojis in color in a TEdit or TMemo control using VCL and Delphi 10+. Can it be done? Text entered: 👨🏼‍🎤👩🏾‍👩🏼‍👧🏻‍👦🏿 What I see: What I'd like to see: Your question made me curious, so tried and here is the result: Drawing colored fonts in general Apparently FMX supports this out of the box in later versions, but not in Seattle, which I happen to have. I don't know if the VCL also supports it out of the box in your version, but if not, you can achieve using Direct2D. The trick is to draw text using the D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT option. In Seattle (10), this