To detect device orientation change, you can use the following example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
uses System.Messaging, FMX.Platform; var FId: Integer; // Subscribe to TOrientationChangedMessage FId := TMessageManager.DefaultManager.SubscribeToMessage(TOrientationChangedMessage, DoOrientationChanged); // Write orientation change handler: procedure TMyForm.DoOrientationChanged(const Sender: TObject; const M: TMessage); var s: IFMXScreenService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, s) then begin case s.GetScreenOrientation of TScreenOrientation.Portrait: ; TScreenOrientation.Landscape: ; TScreenOrientation.InvertedPortrait: ; TScreenOrientation.InvertedLandscape: ; end; end; end; // Unsubscribe the TOrientationChangedMessage TMessageManager.DefaultManager.Unsubscribe(TOrientationChangedMessage, FId); |
Xtumble Web Builder 2 is the basic tool with which we customize all the WEB experience of the applications built on the brand new cloud business platform Xtumble and with which we have created the e-commerce visible on xtumble.store. To allow developers / designers / web developers to be able to customize the applications published…
Read more
Xtumble Web Builder 2 is the basic tool with which we customize all the WEB experience of the applications built on the brand new cloud business platform Xtumble and with which we have created the e-commerce visible on xtumble.store . To allow developers / designers / web developers to be able to customize the applications…
Read more
With Delphi you can create your own applications for Mac OSX 64Bit and distribute them both via the Mac App Store and independently using the Developer ID distribution method. In this article we will see how to distribute an app through the “Notarization” procedure of the app to be able to distribute it independently, even…
Read more
A new version of smartFB, the rapid Firebird and Interbase database management tool. New features: Improved usability and minor graphic tweaks Improved management of embedded database creation Integration with Xtumble4Delphi library for JSON to Delphi Record management Started implementation of a tool that allows you to export / import datasets in MIDAS ClientDataset and FiredacMemTable…
Read more
Highlights word in a RichView component programmatically:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
uses Winapi.RichEdit; procedure SetTextColor(oRichEdit : TRichEdit; sText : String; rAttributes : TTextAttributes); var iPos : Integer; iLen : Integer; Format: CHARFORMAT2; begin FillChar(Format, SizeOf(Format), 0); Format.cbSize := SizeOf(Format); Format.dwMask := CFM_BACKCOLOR; Format.crBackColor := rAttributes.BackColor; iPos := 0; iLen := Length(oRichEdit.Lines.Text) ; iPos := oRichEdit.FindText(sText, iPos, iLen, []); while iPos > -1 do begin oRichEdit.SelStart := iPos; oRichEdit.SelLength := Length(sText) ; oRichEdit.SelAttributes.Color := rAttributes.Font.Color; oRichEdit.SelAttributes.Size := rAttributes.Font.Size; oRichEdit.SelAttributes.Style := rAttributes.Font.Style; oRichEdit.SelAttributes.Name := rAttributes.Font.Name; oRichEdit.Perform(EM_SETCHARFORMAT, SCF_SELECTION, Longint(@Format)); iPos := oRichEdit.FindText(sText,iPos + Length(sText),iLen, []) ; end; end; |
How to highlitgh full cell in a DBGrid:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
procedure TfrmRuleCreator.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); var mstr: String; I : Integer; currValue: string; begin currValue := Column.Field.AsString.ToUpper().Trim; if (Length(currValue) > 3)and(Column.Field.FieldName.ToUpper <> 'NOTE') then Begin If FDMemTable1.FieldByName('NOTE').AsString.ToUpper.IndexOf(currValue) <> -1 then Begin DBGrid1.Canvas.Brush.Color := clYellow; End End; if Column.Field.FieldName.ToUpper = 'NOTE' then DBGrid1.Canvas.Brush.Color := $00D7FFD7; DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; |