Jump to content

Vandrovnik

Members
  • Content Count

    560
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Vandrovnik

  1. Vandrovnik

    How should I organize cross platform code?

    But in the reality it is sometimes like this (taken from Emba example Mobile Snippets\ShareSheet) : uses {$IFDEF ANDROID} Androidapi.Helpers, Androidapi.JNI.JavaTypes, Androidapi.JNI.Os, {$ENDIF} FMX.DialogService; {$R *.fmx} {$R *.LgXhdpiPh.fmx ANDROID} procedure TShareSheetForm.FormCreate(Sender: TObject); begin {$IFDEF ANDROID} FPermissionCamera := JStringToString(TJManifest_permission.JavaClass.CAMERA); FPermissionReadExternalStorage := JStringToString(TJManifest_permission.JavaClass.READ_EXTERNAL_STORAGE); FPermissionWriteExternalStorage := JStringToString(TJManifest_permission.JavaClass.WRITE_EXTERNAL_STORAGE); {$ENDIF} end;
  2. Vandrovnik

    What is the best way LoadFromFile & Thread? (FMX)

    I think loading bitmaps can be run in a thread: http://docwiki.embarcadero.com/RADStudio/Rio/en/Multi-Threading_for_TBitmap,_TCanvas,_and_TContext3D
  3. Vandrovnik

    Getting/Restoring Column Width in TStringGrid with FMX

    I have two monitors, but normaly work on VCL apps. FMX is new for me. Livebindings windows - ehm, I am glad that I almost do not need it; I just connected whole tStringGrid to tIBQuery or tIBDataSet and then edited columns. Now I hope that I will never have to open the Livebindings window again, because it probably would need more than just two monitors 🙂
  4. Vandrovnik

    Getting/Restoring Column Width in TStringGrid with FMX

    Apologies accepted 🙂 grZbozi is just an instance of tStringGrid on my form in the app, from which I have copied that example. So if you put a tStringGrid in your project, it will probably be StringGrid1 instead. In my form, there is declared grZbozi: tStringGrid;
  5. Vandrovnik

    Getting/Restoring Column Width in TStringGrid with FMX

    And do you need the widths immediatelly after the column resize happens? If not, you can read and store column widths in tForm.OnClose.
  6. Vandrovnik

    Getting/Restoring Column Width in TStringGrid with FMX

    Well, in your question, you wrote "TStringGrid to be used with the new projects.". So my answer was for tStringGrid, unfortunatelly I did not clearly write it in my answer and I have already apologized about it. So when you are using tStringGrid, it has indexed property Columns. Each column has property Width. I believe that with this information you can set width of columns (I am using it and it works) and probably you can also read current widths of columns (which I do not use). Try to google FMX TStringGrid Columns.
  7. Hello, I wanted to call tDictionary<>.SetCapacity prior to adding items to it, so that there is no need to re-hash items. Unfortunatelly, tDictionary<>.SetCapacity is private member. Why? Is it an intention, or a bug? Probably there is a way how to access even a private method...? Kind regards, Karel
  8. Vandrovnik

    tDictionary<>.SetCapacity

    Thank you, I have never noticed that I can pass the capacity to .Create...
  9. Vandrovnik

    Getting/Restoring Column Width in TStringGrid with FMX

    grZbozi is instance of tStringGrid, sorry for not writing it in my last reply. a is column index 🙂
  10. Vandrovnik

    Getting/Restoring Column Width in TStringGrid with FMX

    Hello, when I want to change column width of the tStringGrid, I use: grZbozi.Columns[a].Width:=... K.
  11. Do you need pointer to raw image data (say RGB bytes for 24 bit/px images - ScanLine), or pointer to data which you saved to ms in your example? tMemoryStream has property Memory (pointer to its data).
  12. Bitmap1.ScanLine[Bitmap1.Height-1] is start of the image buffer (raw image data, it is bottom up). Buffer size is not so easy; in VCL.Graphics, they have this function (Alignment=32; you need to multiply its result by Bitmap1.Height; look at TBitmap.GetScanLine in VCL.Graphics). function BytesPerScanline(PixelsPerScanline, BitsPerPixel, Alignment: Longint): Longint; begin Dec(Alignment); Result := ((PixelsPerScanline * BitsPerPixel) + Alignment) and not Alignment; Result := Result div 8; end;
  13. Vandrovnik

    Internationalized Domain Names (IDN)

    www.háčkyčárky.cz by CZ Domain Registry.
  14. Vandrovnik

    Internationalized Domain Names (IDN)

    On https://www.xn--hkyrky-ptac70bc.cz/ , there is an e-mail address to which you can send test e-mails and it should send you a reply, if test message was OK. (You can switch the site to English language.)
  15. Vandrovnik

    Why upgrade?

    When you are up-to-date with Delphi, it is easier to accomodate the software to new demands (such as was UTF or HDPI in the past, may be 64 bit in the future - hard to say how many years 32bit apps will be supported, new encryptions etc). Move software to another language will cost a lot of money and time (and new bugs and old features missing in the beginning).
  16. Hello, I have a tStringGrid linked to tIBQuery. In tStringGrid.OnDrawColumnCell, I would like to change font color or style in dependence of data in that column. Now I am able to do something like this: procedure TZasobaForm.grZasobaDrawColumnCell(Sender: TObject; const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF; const Row: Integer; const Value: TValue; const State: TGridDrawStates); begin Canvas.Font.Size:=grZasoba.TextSettings.Font.Size; if (Column<>nil)and(Column.Index=1) then begin Canvas.Font.Style:=[tFontStyle.fsBold]; end; Canvas.Fill.Color:=TAlphaColorRec.Black; Canvas.FillText(Bounds, (Value.AsString), false, 1, [], TTextAlign.taLeading, TTextAlign.taCenter); end; But instead of using if Column.Index=..., I would like to use something like if Column.DataField='PRICE'... How can I obtain field name for the Column? Columns can be moved on runtime, so I cannot expect that Price is always second column in the grid. In .fmx, there is: object grZasoba: TStringGrid Align = Client CanFocus = True ClipChildren = True Size.Width = 391.000000000000000000 Size.Height = 208.000000000000000000 Size.PlatformDefault = False TextSettings.Trimming = None StyledSettings = [Family, Style, FontColor] TabOrder = 1 RowCount = 0 Options = [ColumnResize, ColumnMove, ColLines, RowLines, RowSelect, AlwaysShowSelection, Tabs, Header, HeaderClick] DefaultDrawing = False OnDrawColumnCell = grZasobaDrawColumnCell Viewport.Width = 387.000000000000000000 Viewport.Height = 183.000000000000000000 end object BindSourceZasoba: TBindSourceDB DataSet = qZasoba ScopeMappings = <> Left = 88 Top = 240 end object BindingsList1: TBindingsList Methods = <> OutputConverters = <> Left = 20 Top = 5 object LinkGridToDataSourceBindSourceDB12: TLinkGridToDataSource Category = 'Quick Bindings' DataSource = BindSourceZasoba GridControl = grZasoba Columns = < item MemberName = 'PRICE' Width = 40 end ... Kind regards, Karel
  17. Vandrovnik

    tStringGrid.OnDrawColumnCell - hot to get column field name?

    Thank you for helping me to get the right way!
  18. Vandrovnik

    tStringGrid.OnDrawColumnCell - hot to get column field name?

    So, partial solution... Works with field names (does not depend on headers), works when columns are moved. Works, when data is reloaded from database. But does not keep column width, when user changes the width in runtime (I did not find any event for column width change). // defined as private member in form: grZasobaLink: TLinkGridToDataSource; // I do not know how to obtain BindingsList directly from the StringGrid, so I am passing it as param function GetLinkToDataSource(aBindingsList: tBindingsList; aGrid: tStringGrid): TLinkGridToDataSource; var a: integer; BindComponent: tContainedBindComponent; begin result:=nil; if (aBindingsList=nil)or(aGrid=nil) then exit; for a:=0 to aBindingsList.BindCompCount-1 do begin BindComponent:=aBindingsList.BindComps[a]; if (BindComponent.ControlComponent=aGrid)and(BindComponent is tLinkGridToDatasource) then begin result:=tLinkGridToDatasource(BindComponent); exit; end; end; end; // keep the link, since I will need it often procedure TZasobaForm.FormCreate(Sender: TObject); ... grZasobaLink:=GetLinkToDataSource(BindingsList1, grZasoba); end; procedure TZasobaForm.grZasobaDrawColumnCell(Sender: TObject; const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF; const Row: Integer; const Value: TValue; const State: TGridDrawStates); var FieldName: string; begin Canvas.Font.Size:=grZasoba.TextSettings.Font.Size; if Assigned(grZasobaLink) then FieldName:=UpperCase(grZasobaLink.Columns[Column.Index].MemberName) // Field name! :-) else FieldName:=''; if (FieldName='FYZICKA') then begin Canvas.Font.Style:=[tFontStyle.fsBold]; end; Canvas.Fill.Color:=TAlphaColorRec.Black; Canvas.FillText(Bounds, (Value.AsString), false, 1, [], TTextAlign.Leading, TTextAlign.Center); end; // handle column move procedure TZasobaForm.grZasobaColumnMoved(Column: TColumn; FromIndex, ToIndex: Integer); begin if Assigned(grZasobaLink) then grZasobaLink.Columns[FromIndex].Index:=ToIndex; end;
  19. Vandrovnik

    tStringGrid.OnDrawColumnCell - hot to get column field name?

    I suppose this information already is stored somewhere, so I would like to find it and use it. I cannot rely on the header, but of course I could use tag, build my own list or something like that. It seems that this connection between tStringGrid and data is also partly broken - well, in runtime I can move columns and set their width with mouse, but when the grid is filled again, order and width of columns are lost (this happens in my case when user selects another master record - data for details in the grid has to reload from database, columns where supposed to keep their position and width).
  20. I know, but from these graphs it is still pretty well visible, that issues stay in the queue/stack/whatever longer and longer and that new issues come faster then old issues are resolved. 800 days and increasing, that is a terrible value. I understand they they want to keep up to date with new Android, new iOS etc., but still I believe that they should have a team, which will resolve reported bugs.
  21. I know... And bugs resolved as "will not repair" (ie Translation Manager), bugs marked as duplicate... But the tendency in the graph is the same as my internal feeling in last years.
  22. Yeeees, that is exactly what I was searching for! Nice graphs (with sad data in it). Please can you tell me how to get these graphs from quality.embarcadero.com?
  23. Well, I tried - but when I use (the top one) Export - Excel (all fields), it exports only 1000 issues of more then 16000... May be there is a better way and I just do not see it.
  24. May be Embarcadero could explain how they decide what to do and what to postpone... and postpone...? Because when I compare Embarcadero with TMS or Fastreport (or you), it is often reaction several years vs. several days, which I really do not like. Even https://quality.embarcadero.com/browse/RSP-24548, which should take +- 2 minutes to repair, will probably be there open for years. And please do not argument that it will take much more time because of testing, because the "testing" I can see each day in Object Inspector, which is not showing last letters in text (reported more than a year ago, but did they notice by themselves when testing?), and in Projects (which stops to show its content in 10.3.3 sometimes), and in Toolbars, which are moved randomly each day... I would like to see a statistic, how reported and solved issues develop over years. May be it is somewhere on the web, I do not know.
  25. Vandrovnik

    tStringGrid.OnDrawColumnCell - hot to get column field name?

    Thank you for the answer, but tColumn.Header contains DisplayLabel of the field (which will change with translations to other languages, so I cannot depend on it). There must be the field name, somewhere 🙂
×