Jump to content

Bob Baudewyns

Members
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

1 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Bob Baudewyns

    Creating Gradient by code

    Yep, this is doing the job. Thanks for ColorIndex:= 0 to 4 do begin GradientPoint:= FGradient.Points.Add; TGradientPoint(GradientPoint).Color:= TGradientColors[ColorIndex]; TGradientPoint(GradientPoint).Offset:= TGradientOffsets[ColorIndex]; end;
  2. Bob Baudewyns

    Creating Gradient by code

    Yep. My code is based on this but written in a different way. Do you think that's the reason? This is FMX. I'm targeting all platforms
  3. Bob Baudewyns

    Creating Gradient by code

    I'm looking to define a gradient for TRectangle stroke. I can do that using the editor: Which gives me the following definition: Stroke.Kind = Gradient Stroke.Gradient.Points = < item Color = claRed Offset = 0.000000000000000000 end item Color = claBlue Offset = 0.250000000000000000 end item Color = claYellow Offset = 0.500000000000000000 end item Color = claFuchsia Offset = 0.750000000000000000 end item Color = claLime Offset = 1.000000000000000000 end> Stroke.Gradient.StartPosition.Y = 0.500000000000000000 Stroke.Gradient.StopPosition.X = 1.000000000000000000 Stroke.Gradient.StopPosition.Y = 0.500000000000000000 Stroke.Thickness = 5.000000000000000000 I'm trying to reproduce that Gradient definition by code like this: const TGradientColors: Array[0..4] of TAlphaColor = (claRed, claBlue, claYellow, claFuchsia, claLime); TGradientOffsets: Array[0..4] of Single = (0.0, 0.25, 0.50, 0.75, 1.0); FGradient:= TGradient.Create; for ColorIndex:= 0 to 4 do begin FGradient.Points.Add; FGradient.Points[ColorIndex].Color:= TGradientColors[ColorIndex]; FGradient.Points[ColorIndex].Offset:= TGradientOffsets[ColorIndex]; end; CalcPosition(FAngle, FGradient); But what I get is not at all what I'm expecting: PanelsAppearence.Gradient.Points = < item Color = claRed Offset = 0.000000000000000000 end item Color = claNull Offset = 0.000000000000000000 end item Color = claNull Offset = 0.000000000000000000 end item Color = claNull Offset = 0.000000000000000000 end item Color = claLime Offset = 0.750000000000000000 end item Color = claWhite Offset = 1.000000000000000000 end item Color = claFuchsia Offset = 1.000000000000000000 end> I've searched everywhere for the proper way to define a gradient by code Could you help me?
  4. Hi, I'm looking to outsource the development of a standalone generic custom dialog box framework that can be used from a simple MessageBox (error, warning...) with icon to flexible container to display almost anything Can also act as message toaster Based on the following specifications: FMX Framework. Compliant with FMX styling Independent unit as non-visual component - Non-modal mode like a simple pop-up message - Modal mode, interrupting execution proving same user feedback as standard dialogs when clicking outside - Toaster mode with duration Fully localizable Size: Fixed, Autosize, Sizeable (Win, OSX) Screen Position: Top, Center, Bottom Options to modify - Dialog Background (Color, Fill, Gradient, Image) with opacity - Margins - Dialog Borders (Color, stroke), Corners (Radius), Shadow (Color, opacity) - Shade or Blur the background application behind it Screen Position: Top, Center, Bottom Appearance and disappearance with animations. i.e. : - Fade in / out - Fly: scrolling from a side (top, bottom, left, right) - Grow / Shrink - Split / Wipe, etc... Generic methods to open, update (i.e. progress dialog) and close the dialog Modal result No dependency with another third-party library Full code source delivered. We are owning that code (negotiable). Shipped as a Delphi packages (10.4, 11). A demo application must also be provided to validate the deliverables Need an invoice Please send me your best proposition possibly with additional features in private message Don't hesitate if you have any question to discuss or any comment to improve this project
  5. Thank you for your feedback. I managed to solve my RegEx problems quite some time ago with the help of another member (Fr0sT.Brutal) But this is indeed a very interesting approach.
  6. Bob Baudewyns

    Updating a JSON file with THTTPClient

    Got it. Thanks for the clarification Uwe. Have a nice weekend
  7. Bob Baudewyns

    Updating a JSON file with THTTPClient

    There is absolutely no server action here. Sorry for the confusion. Let's say it's a remote file instead of a file stored on each local computer The file is just sitting there to be shared between computers and potentially modified by one of these computers Imagine this is a configuration JSON file driving the behavior of each computer. But can be changed and affecting all computers that are reading it at startup My question is focusing if I can change that file by code without downloading and uploading it. If I can get the content of the file with THTTPClient.Get, why I couldn't change that content with POST or PUT ?
  8. Bob Baudewyns

    Updating a JSON file with THTTPClient

    The URL is located on a web server. www.smallconsult.com/Tests/Test.json This is for quick test purpose The server response Status Text is just OK. I don't want to upload the file. I want to update the content of that file on the server
  9. Hi, To drive my application, I am downloading at startup a JSON structure from a file located on a server. I need to share that file between me and a remote person. I am doing that successfully with the following code: function GetJSONFromServer(const Filename: string): TJSONObject; var FullURLPath: string; Buffer: TStringStream; Client: THTTPClient; Response: IHTTPResponse; begin Result:= nil; Buffer := TStringStream.Create; try Client := THTTPClient.Create; try FullURLPath:= Concat(URL, '/', Filename); Response:= Client.Options(FullURLPath, nil, 0); if Response.GetStatusCode = 200 then begin Client.Get(FullURLPath, Buffer); if (Buffer.Size > 0) then Result:= TJSONObject.ParseJSONValue(Buffer.DataString) as TJSONObject else Log('ERROR: JSON File is empty !', ErrorColor); end else Log('ERROR: File does not exist on server !', ErrorColor); finally Client.Free(); end; finally Buffer.Free(); end; end; I'm simply trying to do the opposite: Updating the same JSON file at shutdown. The following code doesn't generate any error but the file is not updated. function PostJSONToServer(const Filename: string; const JSONObject: TJSONObject): Boolean; var FullURLPath: string; Buffer: TStringStream; Client: THTTPClient; Response: IHTTPResponse; begin Result:= false; Buffer := TStringStream.Create; try Client := THTTPClient.Create; try FullURLPath:= Concat(URL, '/', Filename); Response:= Client.Options(FullURLPath, nil, 0); if Response.GetStatusCode = 200 then begin Buffer.Seek(0, soFromBeginning); Buffer.WriteString(JSONObject.ToString); Client.Post(FullURLPath, Buffer); if Response.GetStatusCode = 200 then begin Log('Transaction with server successfull !', OkColor); Result:= true; end else Log('ERROR: Transaction with server failed !', ErrorColor); end else Log('ERROR: File does not exist on server !', ErrorColor); finally Client.Free(); end; finally Buffer.Free(); end; end; The buffer contents before posting is correct. Is my code completely wrong ? Should I use another query instead of Post ? Is it a matter of security preventing me to modify the file ? Is there a workaround to allow such transaction ? Thanks
  10. The string conversion is supposed to be done by the end user of the application inside the GUI Not from the IDE by the developer. So, RegEx, running "behind the scene" looks like the best option here.
  11. Oh, I see. Unfortunately not. All of this is inside Delphi code.
  12. Hi, Thank you for your feedback. @Fr0sT.Brutal. I am not at all a RegEx expert. This is Chinese for me. The search string provided is not understood by regex101.com If you are an expert, your help would be greatly appreciated. @David What do you mean exactly by scripting language ? How this could help writing a "formula" to convert such strings ?
  13. I need to update a large number of strings because the syntax is not compliant with the expected format. I would like to automate that process. Such strings can have a mix of alphanumeric, numeric and special characters. A small example would be appropriate here Let's say 3 different strings: NameA 01 01 [A-01] NameB 01 02 [B-02] NameC 01 03 [C-03] Should become: My Name A [1963-A-01] My Name B [1963-B-02] My Name C [1963-C-03] As you can see: - 'My ' is inserted at the beginning - A space is inserted between 'Name' and 'A' - The two groups of numbers before '[' are removed - '1963-' is inserted after '[' Rules: String Length can be different Some characters need to be added/inserted Some others need to be removed Others need to be replaced Inserting space/special characters The same rules must be applied to all strings based on a specific "syntax" defining what should be added/removed/replaced and at which location in the string. Do you known the most efficient way to achieve such smart replacement with Delphi ? Is Regular Expression can be applied here and how ? I'm looking to provide an Edit field that would allow the user to enter the syntax(rules) and see the result applied dynamically like done by Regular Expression web sites
  14. Bob Baudewyns

    How to design QR Scan focus screen with FMX

    Hey, well done ! Thanks
  15. Bob Baudewyns

    How to design QR Scan focus screen with FMX

    Thank you again Rollo62, In the meantime, I did something very close in the IDE with: - 1 TGridPanelLayout - 4 Outer Black TRectangle with opacity 0.5 - 8 Inner Yellow TRectangle with appropriate rounded corners With a TImage as background for rendering the camera, it looks Ok to me
×