Leaderboard
Popular Content
Showing content with the highest reputation on 11/23/22 in all areas
-
Function with 2 return values ?
Fr0sT.Brutal replied to Henry Olive's topic in RTL and Delphi Object Pascal
And I wish there were pure interfaces without that refcount boilerplate. Two completely different models (required set of methods and refcounting) were mixed into one type. -
Function with 2 return values ?
David Heffernan replied to Henry Olive's topic in RTL and Delphi Object Pascal
I once went into our local hardware store to buy a posidrive screwdriver, because I had to do something with a bunch of posidrive screws. The guy in the store scoffed at me and said that they didn't stock posidrive screwdrivers because posidrive screws were a stupid idea. This store is no longer in business. -
Well, it's just pseudo code that happens to look a lot like Delphi code 🙂 . In my defense, I think it actually works as I intended; It will return a match within the tolerance but it might not return the closest match.
-
He needs to draw paths in Winding mode but doesn't want to change the FMX source. This is one of the alternatives, but there are other possibilities.
-
This should work: Obj.O['data'].I['count']
-
Neither. Spawn of satan, should never have been published. In your case do all the behind the scenes work using integers and then divide by 10 just when you need the actual value. Or use a decimal type like currency.
-
Hello, I found a strange complier/linker bug. I'm still using bcb 6 but i thought i'd check with c++builder 10.4 and lo and behold, there's the same bug. Look at the image, it says it all, the result should be zero but it's not. You can see the result in the caption, it's always this number 2.77etc E-17. I've also seen it happen with 10 - 0.1 giving 9.911111 or something. Man i feel bad, i made my life's work with this. Please try this yourself.
-
or SameValue()
-
Installation of fresh Delphi 11.2 fails: Exception in module rtl280.bpl
Hans♫ replied to Hans♫'s topic in General Help
The problem has been solved. I contacted Embarcadero support and they suggested to check the "Controlled Folder Access" in Windows 10. I had it turned on, and after turning it off, I could install Delphi 11.2 without any problems. -
Compare two TIntegerDynArray
Remy Lebeau replied to shineworld's topic in RTL and Delphi Object Pascal
If there is any possibility that FGCodeLinePoints could be passed in to SetGCodeLinePoints() (eg: GCodeEditor1.GCodeLinePoints := GCodeEditor1.GCodeLinePoints;), then I would also add a pointer equality check as well, since dynamic arrays are implemented as ref-counted pinters, eg: procedure TGCodeEditor.SetGCodeLinePoints(Value: TIntegerDynArray); function IsEqualIntegerDynArray(const A, B: TIntegerDynArray): Boolean; var L: Integer; begin if Pointer(A) = Pointer(B) then Exit(True); // <-- HERE L := Length(A); if L <> Length(B) then Exit(False); Result := CompareMem(PInteger(A)^, PInteger(B)^, Sizeof(Integer) * L); end; begin if not IsEqualIntegerDynArray(FGCodeLinePoints, Value) then begin FGCodeLinePoints := Value; Invalidate; end; end; -
Function with 2 return values ?
Sherlock replied to Henry Olive's topic in RTL and Delphi Object Pascal
My hammer beats every other tool every time. -
Function with 2 return values ?
Lars Fosdal replied to Henry Olive's topic in RTL and Delphi Object Pascal
Trouble? 😉 I use a record for returning multiple values. Clarity and type safety is of importance to me. -
If you create a StringStream from an input string, it uses TEncoding.Default. What if you override this by TStringStream.Create(Json, TEncoding.UTF8, False); ?
-
"RTC SDK was originally developed by Danijel Tkalčec in 2004, and acquired by Teppi Technology in 2018 . Now, as of May 20th 2022, we announce that ReatlThinClient SDK (a.k.a. RTC SDK) is open source." https://rtc.teppi.net/ https://github.com/teppicom/RealThinClient-SDK
-
You mean how to assign event? Ok, let me show you 2 methods in the same code private { Private declarations } procedure ItemApplyStyleLookup(Sender: TObject); procedure ItembuttonClick(Sender : TObject); procedure ItemSpeedButtonClick(Sender : TObject); public { Public declarations } end; var Form1: TForm1; implementation {$R *.fmx} uses System.Rtti; procedure TForm1.AddItembtnClick(Sender: TObject); Var ListBoxItem: TListBoxItem; begin // First, we create an empty ListBoxItem with no parent ListBoxItem := TListBoxItem.Create(self); // now, we set a parent for this item ListBoxItem.BeginUpdate; ListBoxItem.Parent := ListBox1; ListBoxItem.Height := 113; ListBoxItem.Width := 336; ListBoxItem.StyleLookup := 'NewList'; ListboxItem.StylesData['txt']:='Data hello'; ListboxItem.StylesData['button.text']:='Data btn'; ListboxItem.StylesData['speedbtn.text']:='speed btn'; // First Method, using onApplyStyleLookup ListBoxItem.OnApplyStyleLookup:=ItemApplyStyleLookup; ListBoxItem.StylesData['button.tag'] := ListBox1.Items.Count-1; // to get itemindex // Second method, direct with StylesData ListBoxItem.StylesData['speedbtn.tag'] := ListBox1.Items.Count-1; // to get itemindex ListBoxItem.StylesData['speedbtn.OnClick'] := TValue.From<TNotifyEvent>(ItemSpeedButtonClick); ListBoxItem.ItemData.Bitmap.LoadFromFile('D:\XE8\icons8-planète-terre-48.png'); ListBoxItem.EndUpdate; end; procedure TForm1.ItemApplyStyleLookup(Sender: TObject); var CustButton : TCustomButton; img : Timage; circle : TCircle; begin custButton:=TListboxItem(Sender).FindStyleResource('button') as TCustomButton; if assigned(custbutton) then custButton.OnClick:=ItembuttonClick; end; procedure TForm1.ItembuttonClick(Sender: TObject); begin ShowMessage('Click on Button '+TCustomButton(Sender).Tag.ToString); end; procedure TForm1.ItemSpeedButtonClick(Sender: TObject); begin ShowMessage('Click on SpeedButton '+TCustomButton(Sender).Tag.ToString); end; Still working on image, thinking about a mask But, consider changing your mind. Instead of a TListBox and style you can use a VerticalScrollBox and Frame
-
I had this problem long time ago but don't remember how I manage it! Indeed, a test with D10 reproduces this behavior (I only had to change a few lines of your program, and use default style removing default, renaming windows 7 to blank -> default). If you read French (google trad can be a friend), I wrote a tutorial long time ago (https://delphi.developpez.com/tutoriels/firemonkey/intro-styles-firemonkey-xe4/). Ideas : Try yo use standard stylenames i.e. txt,icon (especially this one) mystyle : here icon and text can be accessed via ListboxItem.StylesData['txt']:='Data hello'; ListBoxItem.ItemData.Bitmap.LoadFromFile('D:\XE8\icons8-planète-terre-48.png'); As you can see, stile using findstyleresource coding it works better (only speedbutton hidden) but if you code (here, I test my new style) ListboxItem.StylesData['button.text']:='Data btn'; ListboxItem.StylesData['speedbtn.text']:='speed btn'; instead of sequence // Itembtn := ListBoxItem.FindStyleResource('button') as TSpeedButton; // if Assigned(Itembtn) then // Itembtn.Text := 'Btn Hello!'; the whole stuff works as expected. Nowadays, I use more often Listview (dynamic appearance) than ListBox, Writing this other tutorial, I bang another time in this "empty object problem" I override also playing with link (disabling/enabling) and not only with the BeginUpdate/EndUpdate. However I never tested with the new versions to find out if this potential bug had been fixed.