Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
Suggestions / Re: leetcode doesn’t support pascal
« Last post by Joanna on Today at 01:17:35 am »
This thread is yet another good example of why people who don’t know pascal should not be able to post in these forums.
2
Graphics / Re: Demo Scene Picture sinwave
« Last post by Gigatron on Today at 12:48:52 am »
Thank you circular , the BGRA is very powerfull to make demos.

My goal is make simple and short code for each demo part eg:
Copper bars, bitmap font scroller, sinwave, blitter obj (bob) plasma  and so on like Amiga demos.
After that i can combine all fx to make big demo with each part ;
So thank you again for the sinwave fx and here is the short version 60 lines with correction .

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  9.   BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes;
  10.  
  11. type
  12.   { TForm1 }
  13.   TForm1 = class(TForm)
  14.     BGRAVirtualScreen1: TBGRAVirtualScreen;
  15.     Timer1: TTimer;
  16.     procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
  17.     procedure FormCreate(Sender: TObject);
  18.     procedure Timer1Timer(Sender: TObject);
  19.  
  20.   private
  21.  
  22.   public
  23.  
  24.   end;
  25.  
  26. var
  27.   Form1: TForm1;
  28.   Bmp  : TBGRABitmap;  // pic mean picture :)
  29.   acc  : integer;
  30.  
  31. implementation
  32.  
  33. {$R *.lfm}
  34.  
  35. { TForm1 }
  36.  
  37. procedure TForm1.FormCreate(Sender: TObject);
  38. begin
  39.     Bmp := TBGRABitmap.Create('warrior1.png');
  40.     acc := 0;
  41. end;
  42.  
  43. procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);   // wobble or sinwave !!
  44. var i,w : integer;
  45. begin
  46.      i :=0; w :=0; acc := acc + 1;
  47.      for i:=0 to Bmp.Height div 5 do   //
  48.      begin
  49.      w := round(50 + (10 * sin((i+acc) * 6 * PI / 180)));
  50.      Bitmap.PutImagePart(0, i*5-4 , Bmp,  Rect(-50+w,  i*5-4,  Bmp.Width*w ,(i+1)*5-4), dmSet); // xoffset to -50 to center bmp
  51.      end;
  52. end;
  53. procedure TForm1.Timer1Timer(Sender: TObject);
  54. begin
  55.      BGRAVirtualScreen1.RedrawBitmap;
  56. end;
  57.  
  58. end.
  59.  
3
General / Re: open dialog - default directory
« Last post by KodeZwerg on Today at 12:34:53 am »
Here it works with absolute path all the time good.
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   OpenDialog1.InitialDir := 'c:\downloads\';
  4.   if OpenDialog1.Execute then
  5.     ;
  6. end;
I can open, switch to different folders or volumes, selecting something, pressing okay, re-open dialog and I am again in my set folder and not the last.
I did not altered any options, just placed on form.
4
Beginners / Re: Can function be used for change event
« Last post by jamie on Today at 12:26:42 am »
The modified property would be a good one to use however, I think it needs to be cleared when the control gets reentered because  it may retain its last value.

 The idea behind that is you can always have a bunch of controls on a form, each having a MODIFIED property and at the end of the editing session you can then scan all of these controls for changes and then update some external data area. etc.

 but on initial entry of the form, it maybe a good idea to clear all of these.
5
General / Re: open dialog - default directory
« Last post by jamie on Today at 12:16:58 am »
as far as I know, it has never worked in the way it's documented.

 you need to Set your FILENAME with the folder path attached to it.

FileName := 'THe_Directory\'+datei

The InitDir will report where the first folder was pointed to when you exit the dialog.


6
General / Re: DbGrid, grid column checkbox?
« Last post by KodeZwerg on Today at 12:08:29 am »
Since I don't read a real question just a begin of one, here
Anyone designed something similar ...
I simple answer with a yes, anyone did it.
7
General / DbGrid, grid column checkbox?
« Last post by 1HuntnMan on April 24, 2024, 11:13:57 pm »
In the app I'm working, one of my users made a good suggestion. For certain lookup tables, why don't you design the lookup table to have a default, i.e. countries, states/provinces?
So, just testing I added a boolean field to the countries table (TDbf) and then modified the countries maintenance form in my app, which is a small form that has a DBGrid with the Country Code, Country Name, and IS_DEFAULT fields and added a column in the DBGrid for the IS_DEFAULT field with the property ButtonStyle=cbsCheckboxColumn, FieldName=boolean field IS_DEFAULT and ValueChecked=Yes and ValueUnchecked=No.  But, after compiling and running the app. The Countries forms displays the IS_DEFAULT as a column of blue highlighted check boxes with a - or minus sign.  You can't check any of these.  But, if I bring up the countries table in My DBF Studio, his DBGrid is working properly. You can check off any country as the default.
Anyone designed something similar and made it work like My Dbf Studio. Tks.
8
General / Re: Colore celle StringGrid
« Last post by JuanBell on April 24, 2024, 10:37:56 pm »
Grazie di tutto thanks for everything
10
Networking and Web Programming / Re: Any upgrades to fpWeb page components?
« Last post by verasan on April 24, 2024, 10:11:46 pm »
I would be happy for real documentation from developer team
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018