Jump to content

programmerdelphi2k

Members
  • Content Count

    1406
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by programmerdelphi2k

  1. programmerdelphi2k

    How can I enlarge the font of a Combobox in Delphi FMX?

    A "ComboBox" is a container to items = ListBoxItems, for that the styles is applyed on items, not necessary in the container! try use Styles customizations on Combobox -> right-click on ComboBox and Edit Styles customs... and do the changes...
  2. programmerdelphi2k

    BlockRead & BlockWrite - E2010 error

    All installed by default!!! including Help updated! can you see post the BlockWRITE/READ sources here? ( not _BlockWrite/Read )
  3. programmerdelphi2k

    BlockRead & BlockWrite - E2010 error

    in my RAD 11.3 patch 1 ... I DONT HAVE any reference to sources for BlockWrite/BlockRead function!... Find Declaration show nothing!!! System.pas, line 12283, function _BlockWrite(var F: TFileRec; Buffer: Pointer; RecCnt: Integer; RecsWritten: PInteger): Integer;
  4. programmerdelphi2k

    BlockRead & BlockWrite - E2010 error

    @Jud I think that this is +1 error on current Documentation ... in https://www.delphibasics.co.uk/RTL.php?Name=BlockWrite / BlockRead you'll see that BlockWrite/BlockRead is a "PROCEDURE"... not a function! including in FreePascal https://www.freepascal.org/docs-html/rtl/system/blockwrite.html // blockread.html
  5. no code, no (possible) solution! basic infos it's necessary to start how is it ( environment: O.S./platform/etc...) how is it (DLL/ how is it called/ etc..) etc.. etc.. etc...
  6. programmerdelphi2k

    BlockRead & BlockWrite - E2010 error

    better read the "warning" and decide if "you should really still with it"
  7. programmerdelphi2k

    "natural" compare function for sort

    @Ian Branch I think that the Natural Order (to computer) is based on "symbol's" numerical value on the table used not? (normally ASCII table) Which would come first for you: the letter "a=97 / A=65" (lowercase or uppercase), or the number "0 = 48" (zero)? me(...) X StrCmpLogicalW(...)
  8. programmerdelphi2k

    Is there a Sunday between 2 dates ?

    I can also interpret that, with advancing age, many things become difficult to interpret or "accept", so, to finish the succinct question and disagreements: YOU WON and I lost! Period! the said for the unspoken, and, we're all going to have a smooth and cold beer to cool the neurons!
  9. programmerdelphi2k

    Is there a Sunday between 2 dates ?

    while YOU ARE in the "date", there is not any Mid-night... otherwise you would be in the next day!
  10. programmerdelphi2k

    Is there a Sunday between 2 dates ?

    I think that is "well refined" not? any way...
  11. programmerdelphi2k

    Is there a Sunday between 2 dates ?

    @Henry Olive When evaluating how many "Sundays" between two dates, we must take into account the following: sundays between the two dates: 25, 26, 27, 28, 29, 30, 01, 02 = 0 sundays between 2 dates D1 = Jun/25 2023 = Sunday D2 = Jul/02 2023 = Sunday How many "Sundays" are there "BETWEEN" the two dates? A: 0 sundays Using AWE's answer, then, I think it needs revision, no? *answer = 2 sundays That is, as we want to know "how many Sundays exist between two dates, then, we could not take into account the initial and final date, even if they were Sundays, because we are looking for "Sundays between dates", not "Sundays in dates ".
  12. here you can study how do it in Android, BUT ... in Android some changes was implemented for new versions, mainly "disk access/folders". you can use "compiler directives" to separate Android / iOS / WINDOWS codes. https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Conditional_compilation_(Delphi) https://en.delphipraxis.net/topic/4168-fmx-android-using-cam-on-mobile-to-capture-video-and-target-to-timage-permissions-use/?tab=comments#comment-35707
  13. another way, you can try this: copy your problematic text in a any new unit (.PAS) --> you can create using your Notepad/Notepad++/ etc... or saving your "pasted text" in your current unit in the Editor now, try open this file in your IDE normally, the RAD identify that exists some line-feeds non-default (like used in Unix files) and try solve it!
  14. programmerdelphi2k

    TListBox - grouping of items and horizontal scroll bar

    code fixed!!!
  15. programmerdelphi2k

    TListBox - grouping of items and horizontal scroll bar

    @kaarigar you can try some like this: FIXED implementation {$R *.fmx} procedure TForm1.Btn_Create_ItemsClick(Sender: TObject); const LHeaders: array [0 .. 2] of string = ('Header1', 'Header2', 'Header3'); var LBGHeader : TListBoxGroupHeader; LBGHeaderHeight: single; LBItem : TListBoxItem; LBItemHeight : single; LItemHeight : single; LHowManyItems : integer; begin // reset all default values... ListBox1.Clear; ListBox1.ItemHeight := 0; ListBox1.ListStyle := TListStyle.Vertical; ListBox1.Columns := 1; // LBGHeaderHeight := 19; // default values LBItemHeight := 19; LHowManyItems := 1; // for var i: integer := 0 to high(LHeaders) do // if headers with distinct height, then needs some calc... begin LBGHeader := TListBoxGroupHeader.Create(Self); LBGHeader.Text := LHeaders[i]; ListBox1.AddObject(LBGHeader); LBGHeaderHeight := LBGHeader.Height; // here you can verify if a Header is > than before // LHowManyItems := Trunc(SpinBox1.Value); // for var j: integer := 1 to LHowManyItems do begin LBItem := TListBoxItem.Create(Self); LBItem.Text := '... Item' + j.ToString; ListBox1.AddObject(LBItem); LBItemHeight := LBItem.Height; // if Item with distinct height, then needs some calc... end; end; // LItemHeight := ListBox1.ClientHeight - (LBGHeaderHeight + 1); // (LBGHeaderHeight + 1 = line-separator LItemHeight := (LItemHeight / (LHowManyItems + 1)); // LHowManyItems + Header // ListBox1.ItemHeight := LItemHeight; ListBox1.ListStyle := TListStyle.Horizontal; end; initialization ReportMemoryLeaksOnShutdown := true; end.
  16. programmerdelphi2k

    "natural" compare function for sort

    @Tommi Prami in time, (almost 3 year is nothing... isn't) my sample no-dependences of DLL, then you can use it in any platform! https://en.delphipraxis.net/topic/9276-my-tstringlist-custom-sorting-trying-to-mimic-windows-explorer-way/
  17. programmerdelphi2k

    Delphi Image Cropper Component?

    @Johansy in fact, you dont needs any 3rd components, you can use native controls in FMX RAD.. RAD 11.3 1 TImage to load original image / 1 to preview / 1 to cropping (for my tests) 1 TSelection to "select your area" on screen (in case, in my TImage Original image) a little code to work! if needs more actions, just do it... for example: rotations, Image1.RotationAngle := 90; ... when cropping you needs rotate the values in Rect( L,T, R, B) etc... nothing complicated at all. for "Position" on Preview or Cropping TImage, just use the coordenates X,Y... not "0,0" ... to Mobiles, use (in Selection control) a TGestureManager + events as Mouse events! type TForm1 = class(TForm) imgOriginal: TImage; Selection1: TSelection; Rectangle1: TRectangle; imgPreview: TImage; Label1: TLabel; Rectangle2: TRectangle; imgCropping: TImage; Label2: TLabel; Btn_Cropping: TButton; procedure Btn_CroppingClick(Sender: TObject); procedure Selection1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single); procedure FormCreate(Sender: TObject); procedure Selection1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); procedure Selection1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); private public end; var Form1: TForm1; implementation uses FMX.MultiResBitmap; {$R *.fmx} var LRect : TRect; LMovingMouse: boolean = false; procedure MyCroppingBitmap(ASelX, ASelY, ASelW, ASelH: Single; AImgSrc, AImgTrg: TImage); var LCBItem: TCustomBitmapItem; begin LRect := Rect(Trunc(ASelX), Trunc(ASelY), Trunc(ASelW), Trunc(ASelH)); // if AImgTrg.MultiResBitmap.Count > 1 then AImgTrg.MultiResBitmap.Clear; // always you'll have 1 Item!!! // LCBItem := AImgTrg.MultiResBitmap.Items[0]; // note: Always exists 1 item!!! LCBItem.Bitmap.Width := Trunc(ASelX + ASelW); LCBItem.Bitmap.Height := Trunc(ASelY + ASelH); LCBItem.Bitmap.CopyFromBitmap(AImgSrc.Bitmap, LRect, 0, 0); end; procedure TForm1.FormCreate(Sender: TObject); begin imgOriginal.WrapMode := TImageWrapMode.Original; // ? imgPreview.WrapMode := TImageWrapMode.Original; // ? imgCropping.WrapMode := TImageWrapMode.Original; // ? end; procedure TForm1.Selection1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin LMovingMouse := true; end; procedure TForm1.Selection1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin LMovingMouse := false; end; procedure TForm1.Selection1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single); begin if LMovingMouse then MyCroppingBitmap( { } Selection1.Position.X, { } Selection1.Position.Y, { } Selection1.Position.X + Selection1.Width, { } Selection1.Position.Y + Selection1.Height, { } imgOriginal, { } imgPreview { } ); end; procedure TForm1.Btn_CroppingClick(Sender: TObject); begin MyCroppingBitmap( { } Selection1.Position.X, { } Selection1.Position.Y, { } Selection1.Position.X + Selection1.Width, { } Selection1.Position.Y + Selection1.Height, { } imgOriginal, { } imgCropping { } ); end; initialization ReportMemoryLeaksOnShutdown := true; end.
  18. programmerdelphi2k

    Registering user activity?

    @Gonzalo Fernandez another suite can be GrijjyCloudLogger, remote logging for Windows, iOS, Android, macOS and Linux https://blog.grijjy.com/2017/08/22/grijjycloudlogger-remote-logging-for-windows-ios-android-macos-and-linux/
  19. programmerdelphi2k

    Registering user activity?

    @Uwe Raabe https://community.embarcadero.com/blogs/entry/using-app-tethering-to-enable-codesite-for-tracing-mobile-apps-with-bob-swart Look this:
  20. I think that no really needs "MyReCreatingMyString( ... )" at all... you can delete it!!! Now, let's study "Natural Sort Order..." ... 🙂 unit uMyTools; interface function MyNormalizeString(AStr: string; AValLength: byte = 10): string; implementation uses System.SysUtils, System.StrUtils; const LMyDigits: TSysCharSet = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; function MyNormalizeString(AStr: string; AValLength: byte = 10): string; var LStr: string; LVal: string; LEnd: integer; begin LStr := ''; LVal := ''; LEnd := AStr.Length; // { ex. Text1 and Text1234567890 and Text123456789012345 = part complex!!! AValLength := ? Text0000000001 Text1234567890 Text123456789012345 // ... we can have it with distinct length, then we use an arbitrary value! } if (AValLength < 10) then AValLength := 10 else if (AValLength > 20) then AValLength := 20; // for var i: integer := 1 to LEnd do begin if CharInSet(AStr[i], LMyDigits) then begin LVal := LVal + AStr[i]; // if ((i + 1) <= LEnd) and not(CharInSet(AStr[i + 1], LMyDigits)) then begin LStr := LStr + DupeString('0', AValLength - LVal.Length) + LVal; LVal := ''; end; end else LStr := LStr + AStr[i]; end; // if not LVal.IsEmpty then LVal := DupeString('0', AValLength - LVal.Length) + LVal; // result := LStr + LVal; end; end. function MyStringListCustomSort(SL: TStringList; ALeft, ARight: integer): integer; var LCLeft, LCRight : string; CmpLeft, CmpRight: string; begin LCLeft := LowerCase(SL[ALeft]); LCRight := LowerCase(SL[ARight]); // CmpLeft := MyNormalizeString(LCLeft); CmpRight := MyNormalizeString(LCRight); // result := CompareStr(CmpLeft, CmpRight); // if (result = 0) then result := CompareStr(LCLeft, LCRight); end;
  21. programmerdelphi2k

    AidAim Component

    on site said: 03/27/2023 laste updates... then, I think that is working
  22. programmerdelphi2k

    W1057 during D7 -> D11 conversion

    @Bart Verbakel did you see this: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/W1057_Implicit_string_cast_from_'%s'_to_'%s'_(Delphi) <your_target_string> := string(<your_ansi_source); // explicitly before usage, avoid implicity convertion NOTE: See too https://docwiki.embarcadero.com/RADStudio/Alexandria/en/W1059_Explicit_string_cast_from_'%s'_to_'%s'_(Delphi) (Explictiy: warning ) As rule: avoid ShortString in new IDE! or use "compiler directives" {$IFDEF VER350} xxxx {$ELSE} wwww {$ENDIF} https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Compiler_Versions https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Conditional_compilation_(Delphi)
  23. programmerdelphi2k

    How to Sort TStringList ?

    @amit try my sample https://en.delphipraxis.net/topic/9276-my-tstringlist-custom-sorting-trying-to-mimic-windows-explorer-way/
  24. @amit you can try this way: create a bat file with your logic ( you'll need define a enviroment var with your new-name, for example...) using the Post-Build event you can call it rem --- OldName = full path + filename = c:\...\MyOldName.exe set OldName=%1 rem --- NewName = new file name = MyNewName.txt set NewName=MyNewName.exe rem ---------- renaming file ----------- ren %OldName% %NewName% > texto.txt
  25. programmerdelphi2k

    How to Sort TStringList ?

    sorry, all wrong !!!
×