Recent

Recent Posts

Pages: 1 [2] 3 4 ... 10
11
General / Is there a better web-browser component?
« Last post by QEnnay on Today at 12:54:09 am »
Hi, I am running Linux-Mint-22_Cinnamon with Lazarus 3.2. I have an embedded web-browser using lpHTMLDataProvider and the associated Text and HTML Panels.

The Text is good as long as there is an incoming text version. But, the HTML is pretty poor as I generally only see about 40% of the content.

I can save the HTML to a desktop-file and then use FFx to open it and all is good.

Is there a better HTML component available? I'd like free as it is a simple project at home.
12
General / Re: Change button background color
« Last post by LBoxPO on Today at 12:24:05 am »
Thanks to all for trying to help.  In the end, I added a panel to my main form, then I added another panel to that panel, one for each button.  I used the MouseEnter and the MouseLeace events to mimic the look of a button and of course the onClick event to run additional code.  Please see the attached
picture.

TD

But what if you need buttons with rounded corners?  :)
13
* Mac Mini M1 (silicon)
* macOS 14.6.1
* Lazarus 3.4
* FPC 3.2.2

I would like to build a resource file from a text file that looks like this, but much bigger (~520 lines)

Code: Text  [Select][+][-]
  1. bass
  2. 30, 1, "acid bass", "aggressive + analog + distorted + stereo"
  3. 30, 2, "acouskop", "acoustic + distorted + fm + shaking"
  4. 30, 31, "bass distosine", "acoustic + synthetic"
  5. 30, 32, "bass monster", "analog + distorted + portamento + synthetic"
  6. 30, 74, "chordead", "analog + chords"
  7. 30, 108, "deep corners", "analog + chords"
  8. 30, 112, "dirt acid", "analog + distorted"
  9. 30, 119, "doubleslap", "acoustic + shaking + warm + woody"
  10. 30, 127, "edgy fm", "fm"
  11. 31, 3, "eighty neon", "analog"
  12. 31, 5, "electric bass 1", "acoustic + electric"
  13. 31, 6, "electric bass 2", "acoustic + electric"
  14. 31, 29, "fat model d", "analog + big + noise + portamento + warm"
  15. 31, 36, "flunkly", "analog"
  16. 31, 43, "fm darkness", "aggressive + big + dark + digital + dry + ensemble + fm + noise"
  17. 31, 44, "fm doublebass", "clean + fm + portamento"
  18. 31, 50, "fm slapman", "bright + digital + fm + metallic + stereo"
  19. 31, 54, "forgotten animal", "analog + fm + portamento"
  20. 31, 55, "forty eight db", "analog + distorted"
  21. 31, 56, "fourad", "analog + distorted"
  22. 31, 57, "fretless bass", "acoustic + portamento"
  23. 31, 76, "grittysaw", "analog + distorted"
  24. 31, 86, "hollowrez", "analog"
  25. 31, 107, "juknow that bass", "analog + big + clean + simple + soft + stereo"
  26. 31, 121, "kinespeech", "analog + vocal"
  27. 32, 5, "lacous bass", "acoustic + portamento"
  28. 32, 7, "ladder bass", "analog + lfo + synthetic"
  29. 32, 58, "night bass", "analog + portamento"
  30. 32, 92, "outspoken", "analog"
  31. 32, 109, "piercing bass", "aggressive + big + dark + digital"
  32. 32, 114, "pl-bass", "analog + dry + warm"
  33. 32, 126, "pulzz", "analog"
  34. 33, 5, "reesotto", "aggressive + digital"
  35. 33, 6, "reesy rider", "aggressive + analog + distorted + stereo"
  36. 33, 19, "rusty bass", "dark + digital + fm + soft"
  37. 33, 20, "rusty square", "analog + distorted"
  38. 33, 39, "simpledecay", "analog + distorted"
  39. 33, 41, "simplerez", "analog"
  40. 33, 48, "smooth operator", "acoustic + fm"
  41. 33, 49, "solid square", "analog"
  42. 33, 68, "steroids", "analog + noise"
  43. 33, 74, "sub bass 1", "analog"
  44. 33, 75, "subway", "analog + clean + dark + fm + simple"
  45. 33, 77, "syncat", "analog"
  46. 33, 95, "thrilla bass", "analog + dry"
  47. 33, 114, "velsquare", "analog"
  48. 33, 119, "vintage wide bass", "analog + big + dark + portamento + soft + stereo + warm"
  49. 33, 125, "walking blues", "acoustic"
  50. 33, 127, "wallface", "digital + fm + portamento"
  51.  

I've tried creating an LRS file but my build is failing for some reason. The LRS file looked like this...
Code: Text  [Select][+][-]
  1. LazarusResources.Add('OsmosePresetData','TEXT',[
  2.   'bass',
  3.   '',
  4.   '30, 1, "acid bass", "aggressive + analog + distorted + stereo"',
  5.   '30, 2, "acouskop", "acoustic + distorted + fm + shaking"',
  6.   '30, 31, "bass distosine", "acoustic + synthetic"',
  7.   '30, 32, "bass monster", "analog + distorted + portamento + synthetic"',
  8.   '30, 74, "chordead", "analog + chords"',
  9.   '30, 108, "deep corners", "analog + chords"',
  10.   '30, 112, "dirt acid", "analog + distorted"',
  11.   '30, 119, "doubleslap", "acoustic + shaking + warm + woody"',
  12.   '30, 127, "edgy fm", "fm"',
  13.   '31, 3, "eighty neon", "analog"',
  14.   '31, 5, "electric bass 1", "acoustic + electric"',
  15.   '31, 6, "electric bass 2", "acoustic + electric"',
  16.   '31, 29, "fat model d", "analog + big + noise + portamento + warm"',
  17.   '31, 36, "flunkly", "analog"',
  18.   '31, 43, "fm darkness", "aggressive + big + dark + digital + dry + ensemble + fm + noise"',
  19.   '31, 44, "fm doublebass", "clean + fm + portamento"',
  20.   '31, 50, "fm slapman", "bright + digital + fm + metallic + stereo"',
  21.   '31, 54, "forgotten animal", "analog + fm + portamento"',
  22.   '31, 55, "forty eight db", "analog + distorted"',
  23.   '31, 56, "fourad", "analog + distorted"',
  24.   '31, 57, "fretless bass", "acoustic + portamento"',
  25.   '31, 76, "grittysaw", "analog + distorted"',
  26.   '31, 86, "hollowrez", "analog"',
  27.   '31, 107, "juknow that bass", "analog + big + clean + simple + soft + stereo"',
  28.   '31, 121, "kinespeech", "analog + vocal"',
  29.   '32, 5, "lacous bass", "acoustic + portamento"',
  30.   '32, 7, "ladder bass", "analog + lfo + synthetic"',
  31.   '32, 58, "night bass", "analog + portamento"',
  32.   '32, 92, "outspoken", "analog"',
  33.   '32, 109, "piercing bass", "aggressive + big + dark + digital"',
  34.   '32, 114, "pl-bass", "analog + dry + warm"',
  35.   '32, 126, "pulzz", "analog"',
  36.   '33, 5, "reesotto", "aggressive + digital"',
  37.   '33, 6, "reesy rider", "aggressive + analog + distorted + stereo"',
  38.   '33, 19, "rusty bass", "dark + digital + fm + soft"',
  39.   '33, 20, "rusty square", "analog + distorted"',
  40.   '33, 39, "simpledecay", "analog + distorted"',
  41.   '33, 41, "simplerez", "analog"',
  42.   '33, 48, "smooth operator", "acoustic + fm"',
  43.   '33, 49, "solid square", "analog"',
  44.   '33, 68, "steroids", "analog + noise"',
  45.   '33, 74, "sub bass 1", "analog"',
  46.   '33, 75, "subway", "analog + clean + dark + fm + simple"',
  47.   '33, 77, "syncat", "analog"',
  48.   '33, 95, "thrilla bass", "analog + dry"',
  49.   '33, 114, "velsquare", "analog"',
  50.   '33, 119, "vintage wide bass", "analog + big + dark + portamento + soft + stereo + warm"',
  51.   '33, 125, "walking blues", "acoustic"',
  52.   '33, 127, "wallface", "digital + fm + portamento"'
  53. ]);
  54.  

This was based on a suggestion given to me by Claude Sonnet 3.5 AI. Not surprisingly it didn't work!
I'm referencing the LRS file with...
Code: Pascal  [Select][+][-]
  1. {$R OsmosePresetResources.lrs}
  2.  
FWIW..

This is the build error I'm getting...
Code: Text  [Select][+][-]
  1. Compile Project, Target: /Users/carlcaulkett/Code/FPC/Osmose Presets/OsmosePresets: Exit code 1, Errors: 1
  2. view.pas(29,0) Error: Can't open resource file "/Users/carlcaulkett/Code/FPC/Osmose Presets/OsmosePresetResources.lrs"
  3.  

Presumably the format of the LRS file is stopping it from being able to be loaded...

I've since discovered messages that suggest that the RES file format is now preferred over the old LRS format. But how do I build a RES file from a text file? The how-to in the documentation seems not to be up to date. I'd like, eventually, to access the resource using a TResourceStream. Admittedly it's getting quite late here in England, so not a lot is making sense at the moment. A little nudge in the right direction would be most welcome  ;)
14
Graphics / Re: Bitmap 16bit R5G6B5
« Last post by wp on Today at 12:09:15 am »
Try this, using two TLazIntfImages to explicitely convert pixel format:
Code: Pascal  [Select][+][-]
  1. uses
  2.   FPWriteBMP, IntfGraphics, GraphType;
  3.  
  4. procedure SaveBitmapToStream16bpp(ABitmap: TBitmap; AStream: TStream);
  5. var
  6.   srcImg, destImg: TLazIntfImage;
  7.   rawImg: TRawImage;
  8.   writer: TFPWriterBMP;
  9.   x, y: Integer;
  10. begin
  11.   // Convert source bitmap to a TLazIntfImage
  12.   srcImg := ABitmap.CreateIntfImage;
  13.  
  14.   // Prepare destination image for 16bpp
  15.   destImg := TLazIntfImage.Create(0, 0);
  16.   try
  17.     rawImg.Init;
  18.     rawImg.Description.Init_BPP16_R5G6B5(srcImg.Width, srcImg.Height);
  19.     rawImg.CreateData(false);
  20.     destImg.SetRawImage(rawImg);
  21.  
  22.     // Copy pixels from source to destination image (and convert them to 16bpp automatically)
  23.     for y := 0 to destImg.Height-1 do
  24.       for x := 0 to destImg.Width-1 do
  25.         destImg.Colors[x, y] := srcImg.Colors[x, y];
  26.  
  27.     //Save destination image to stream
  28.     writer := TFPWriterBMP.Create;
  29.     try
  30.       writer.BitsPerPixel := 16;   // important!
  31.       destImg.SaveToStream(AStream, writer);
  32.     finally
  33.       writer.Free;
  34.     end;
  35.   finally
  36.     destImg.Free;
  37.     srcImg.Free;
  38.   end;
  39. end;
  40.  
  41. procedure SaveBitmapToFile16bpp(ABitmap: TBitmap; AFileName: String);
  42. var
  43.   stream: TFileStream;
  44. begin
  45.   stream := TFileStream.Create(AFileName, fmCreate);
  46.   try
  47.     SaveBitmapToStream16bpp(ABitmap, stream);
  48.   finally
  49.     stream.Free;
  50.   end;
  51. end;
  52.  
  53. { TForm1, contains a button and two images }
  54.  
  55. procedure TForm1.Button1Click(Sender: TObject);
  56. begin
  57.   Image1.Picture.LoadFromFile(SRC_FILENAME);
  58.   SaveBitmapToFile16bpp(Image1.Picture.Bitmap, DEST_FILENAME);
  59.   Image2.Picture.LoadFromFile(DEST_FILENAME);
  60. end;

Or this, using implicit conversion by setting the destination bitmap's pixelformat and drawing the original bitmap onto its canvas (still a LazIntfImage is needed for saving the 16bpp bitmap):
Code: Pascal  [Select][+][-]
  1. procedure SaveBitmapToStream16bpp(ABitmap: TBitmap; AStream: TStream);
  2. var
  3.   bmp: TBitmap;
  4.   img: TLazIntfImage;
  5.   writer: TFPWriterBMP;
  6. begin
  7.   bmp := TBitmap.Create;
  8.   try
  9.     // Convert source bitmap to 16bpp
  10.     bmp.PixelFormat := pf16bit;
  11.     bmp.SetSize(ABitmap.Width, ABitmap.Height);
  12.     bmp.Canvas.Draw(0, 0, ABitmap);
  13.  
  14.     // Save the destination bitmap to stream, retaining the 16bpp
  15.     img := bmp.CreateIntfImage;
  16.     try
  17.       writer := TFPWriterBMP.Create;
  18.       try
  19.         writer.BitsPerPixel := 16;  // Important
  20.         img.SaveToStream(AStream, writer);
  21.       finally
  22.         writer.Free;
  23.       end;
  24.     finally
  25.       img.Free;
  26.     end;
  27.   finally
  28.     bmp.Free;
  29.   end;
  30. end;
15
Android / Incorrect FPC/Lazarus build?
« Last post by Seenkao on September 16, 2024, 11:58:01 pm »
Windows
Установка FPC/Lazarus с помощью FPCUPDeluxe.
Установлены кросскомпиляторы для Android: Arm32/64, x86_64, x86.

Один кросскомпилятор установил до установки Android Studio + NDK.

Кусок лога, где возникает ошибка внизу. Сама ошибка, как я понимаю, возникает в файле C:\laz2\cross\bin\all-android\bin\arm-linux-androideabi-ld.bfd.exe , как туда попадает этот путь мне не известно. Как можно решить данную проблему?
Сама проблема в слешах, как я понимаю: "\/"

------------------------
Google translate:
Windows
Installing FPC/Lazarus using FPCUPDeluxe.
Cross compilers for Android are installed: Arm32/64, x86_64, x86.

I installed one cross compiler before installing Android Studio + NDK.

A piece of the log where the error occurs is below. The error itself, as I understand it, occurs in the file C:\laz2\cross\bin\all-android\bin\arm-linux-androideabi-ld.bfd.exe, how this path gets there I don't know. How can I solve this problem?
The problem itself is in the slashes, as I understand it: "\/"

Quote
C:\laz2\cross\bin\all-android\bin\arm-linux-androideabi-ld.bfd.exe: C:\Users\Mirrel\AppData\Local\Android\Sdk\ndk\27.1.12297006\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\arm-linux-androideabi\35\/libc.so: unable to initialize decompress status for section .debug_abbrev
C:\laz2\cross\bin\all-android\bin\arm-linux-androideabi-ld.bfd.exe: C:\Users\Mirrel\AppData\Local\Android\Sdk\ndk\27.1.12297006\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\arm-linux-androideabi\35\/libc.so: unable to initialize decompress status for section .debug_abbrev
C:\Users\Mirrel\AppData\Local\Android\Sdk\ndk\27.1.12297006\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\arm-linux-androideabi\35\/libc.so: file not recognized: File format not recognized
16
General / Re: "Show Compiler Dialog"
« Last post by dsiders on September 16, 2024, 11:56:42 pm »
The wlki at https://wiki.freepascal.org/IDE_Window:_Environment_Options talks about there being an option to enable the "Show Compiler Dialog".

I've looked in Settings -> Environment -> Files as the wiki suggests and I cannot see it anywhere. Is this a case of the docs not keeping in sync with the actual software?

You can set specific compiler options in Project > Project Options > Compiler Options. There is a button at the bottom of Project Options captioned "Show Options".

It is not on the IDE Options dialog; compiler options are per project.

And, on the referenced wiki page, I see no mention of "Show Compiler Dialog".



17
General / Re: DBGRID | Picklist on field
« Last post by korba812 on September 16, 2024, 11:52:34 pm »
You can use OnSelectEditor event and customize editor control.

Code: Pascal  [Select][+][-]
  1. type
  2.   TFakeEditor = class(TPickListCellEditor)
  3.  
  4.   end;
  5.  
  6. procedure TForm1.DBGrid1SelectEditor(Sender: TObject; Column: TColumn;
  7.   var Editor: TWinControl);
  8. begin
  9.   if {(Column = MyColumn) and} (Editor is TPickListCellEditor) then
  10.     TFakeEditor(Editor).ItemWidth := 160;
  11. end;
  12.  
Unfortunately ItemWidth property is protected in TPickListCellEditor so in example I used a workaround (subclassing).
18
General / Re: Listview how to custom or show subtitle
« Last post by VisualLab on September 16, 2024, 11:38:39 pm »
Yeah,i think all program language should become simple.

Simpler, which means what? What is this simplicity supposed to consist of? Because each person probably understands simplicity a bit differently. For one person, a Trabant car is simple, while a Boeing 777 is complicated. And for another, a stick is simple, while a Trabant is incredibly complicated. Besides, there were many before you who wanted simple languages. And they set out to create them. Denis Ritchie also created a very simple programming language. So what, is C simple? Graydon Hoare was annoyed that C was terrible, complicated, and full of traps, so he started creating Rust. So what, is Rust simple? It was the same every time - after many years, every simple programming language became complicated, even Python, adored by script kiddies :)

Window PC application language update too slow.

Which language? Or maybe you mean the process of developing programming languages? There is no such thing as a "Windows PC programming language". Some programming languages ​​are narrowly specialized (JavaScript, Matlab, R), others have broader applications (e.g. those compiled to machine code). The development of languages ​​is decided by people involved in the tools (compilers, interpreters) that allow these languages ​​to be used in practice. And the users choose what suits them.

i love internet program code, js,swift,electron,python, and so easy to learning.

OK. So use them. But if you are asking on this forum about solving some programming problems, then I suspect that the languages ​​you mentioned have some flaws and/or limitations. Otherwise, you wouldn't be asking. It's true that they are easy to learn. But at the same time, they also have limited capabilities. These are languages ​​for writing scripts, not creating software programs.

If just program tradition pc application, lazarus and delphi are so good and easy. but me need few new function display streams info, as http, ws, p2p, irc, mqtt message.

What you wrote about are data transfer protocols, not streams. Data streams are handled by internal classes of the WWW browser. Writing a class that supports these protocols requires considerable programming knowledge.

i find lz and delphi can not display one base web page. ie.: use TwebBrowser component can not load an resources(RCDATA) file (its include html+js+css), since TwebBrowser base on ie9, its can not contain indexof and filter etc. use webkit can do few thing but pascal forget to update the webkit. you know old webkit still better than the ie9.

The part of the browser that handles data processing (HTML, CSS, JS) and its display and playback is significantly complex. Those are thousands of classes written in C++. The part of the browser that handles data processing (HTML, CSS, JS) and its display and playback is much more complicated. These are thousands of classes written in C++. KDE programmers, then Apple and Google, wrote and improved it for many years. What Delphi or Lazarus offers is a set of classes that provide the facade of this vastness.

ok, you maybe want ask me, why not use cef3,or mircosoft new Browser component?
because, today all Browser is spy tools. only a bit cookies, all Browser integration webrtc,ws,and more private protocol. they just want help you save data to cloud.

Well, you can always try using C++, C# or Java. But there will be some difficulties when programming in these languages, just like in the case of Object Pascal. It is often a matter of the size and capabilities of the libraries.

i just want use smallest code, smallest size to build few small pc application. use ws, http only want build an chat/talk application etc.
But Browser use the ws,rtc that is thief tools.

Web service applications that need to use network protocols seem simple to build. But that's an illusion. Their internal architecture is typically quite complex.

Now, assume your need build the chat application use the delphi or lazarus. you need design db, cache, queue, chat listviw, wss authenticate (dont talk me use old way to connect wss, that you can help google robot essy to get more).

Well, if you want to create such a program, then the burden of designing it, selecting tools and libraries falls on you. But you will also have to write a lot of code yourself. This is what programming is all about. We can only advise you, point out some solutions or try to find errors when you encounter a more difficult problem. But you are the author and you know best what the goal you are striving for should look like.

Current, i know and find more quesiton when use vc,lazarus,delphi. i am new pascal user. so need few time.

Yes. Most of the participants of this forum have gone down this path in the past (and some are probably still on it).



You may be offended (although that's not the goal), but if you started your "encounter with programming" by creating websites (HTML, CSS, JS) and then writing scripts in Python, then I understand the difficulties that arise (that's what your complaining suggests). Writing simple things in scripting languages (especially: Python, Electron, etc. monsters and nightmares) gives a false sense of being able to program. You may be offended (although that's not the goal), but if you started your "encounter with programming" by creating websites (HTML, CSS, JS) and then writing scripts in Python, then I understand the difficulties that arise. Writing simple things in scripting languages ​​(especially Python, Electron, etc., monsters and nightmares) gives you a false sense that you can program. Because many people think that writing programs consists of taking library X, then gluing it to library Y, and then connecting what was created to Z.

 I myself remember how many years ago (17-20) on some forum someone wrote that he wanted to create a game of the FPP shooter type, in connection with which he had a question whether there was a component like TQuake (or similar), because it would allow him to simplify writing "his" game. Needless to say, the regulars had a lot of fun. Besides, at that time there was a lot of criticism of the component and widget approach (unfairly, as time has shown).

However, programming is not about "gluing libraries together" or "placing components on forms". Yes, libraries are very useful (even desirable) so as not to "reinvent the wheel". But there are no libraries that solve every problem. So you either have to adapt what is there (classes, procedures) to your needs or write the necessary code yourself. And that requires a lot of learning and work.
19
General / Re: Problems with case statement [SOLVED]
« Last post by carl_caulkett on September 16, 2024, 11:28:40 pm »
If you manage to get anything like that happen again then freeze it: zip the entire directory tree without deleting anything. My suspicion is that you'd found a way to trigger a subtle problem- and I'm not sure whether this is the IDE or compiler- where something was not recompiled when it should have been and having the various intermediate files might enable the developers (poor dears!) to track it down.

Yes, you're quite right, I should have kept a frozen copy. I was more concerned with getting it working, but I appreciate that capturing these, thankfully rare, glitches is the only way they're going to get fixed.
20
General / Re: Problems with case statement [SOLVED]
« Last post by carl_caulkett on September 16, 2024, 11:23:58 pm »
Thanks! It's okay. There were quite a few improvements over the original post, eg. the use of +=.
Pages: 1 [2] 3 4 ... 10

TinyPortal © 2005-2018