

azrael_11
Members-
Content Count
66 -
Joined
-
Last visited
Community Reputation
0 NeutralTechnical Information
-
Delphi-Version
Delphi 10.3 Rio
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Hello... I install the Intraweb 14 and when i open Delphi 10.4 i get this error Can someone tell me how to fix this. Thank you,
-
After 2 year ago and i have found no solution ... always get " unsupported media file "
-
How can i retrive components from a dat file;
azrael_11 replied to azrael_11's topic in RTL and Delphi Object Pascal
I think this is the best way. Thanks -
How can i retrive components from a dat file;
azrael_11 posted a topic in RTL and Delphi Object Pascal
Based to this Implementing Object Persistence using Streams i think i manage to save all the runtime created components of my form in a dat file. with this code when the form closes procedure TForm.FormClose(Sender: TObject; var Action: TCloseAction); var strm: TFileStream; vi: integer; begin strm := TFileStream.Create('MyComponentList.txt', fmCreate); for vi := 0 to ComponentCount - 1 do strm.WriteComponent(Components[vi]); strm.Free; end; Now how can i load all the components in FormCreate or In FormShow event. In tutorial can read-load a component by its name. So how can i get the name of all components in the dat file so i can read-load? -
Hi I am totally new to android development with delphi. I success to setup and deploy a simple program in my device. Now try to create a folder in Documents folder ->storage->0->Documents->myProject and put images and text files in it. But i dont know how. Any simple examples. And one more question how can i find if the Documents folder exists. Thank you
-
Thank you very much for all the help. If you have and html sites to read about md5 or sha1 or crc i appreciate.
-
Hello I download an image from the internet and the author gives me the sha1, md5 and crc or the image to check if the download image is correct. 1. Can i take somehow the sha1 or md5 or crc of the downloaded image with delphi. 2. Can i do this with Turbo LockBox components. And if i can a simple example how to do this or a web site to explain. 3. Can i add different sha1 or md5 or crc in the same image Thank you
-
I see that the best option is from winsoft components but i don't want to pay for a free program. I think the best way is to write a new one from the scratch.
-
Thank you remy i'll check it out. Btw do you know any good components or header for joystick either mmsystem or DInput or Xinput... Thank you again
-
Yes it triggered only one time hmmm Is there a change to have problem that i use FMX platform.
-
Thank you very much now i have the x and y for one time Now how can i handle x and y every time the program is on. Is it a good practice to put a timer and every x seconds runs the MyOnMoveHandler ?
-
i have this unit found a long time ago. it is a joystick unit using the mmsystem. unit joy; interface uses System.SysUtils, FMX.Types, WinTypes, WinProcs, Messages, Classes, MMSystem; type TGamePort = (One, Two, None); TJoyMoveEvent = procedure(Sender: TObject; var X, Y: Integer) of object; TButtonNotifyEvent = procedure(Sender: TObject; Pushed: Boolean) of object; type TJoystick = class(TComponent) private { Internal private uses } CenterX: LongInt; CenterY: LongInt; DeltaPosX, DeltaNegX: LongInt; DeltaPosY, DeltaNegY: LongInt; JoyId: Word; JoyCaps: TJoyCaps; JoyInfo: TJoyInfo; { Published Private declarations } FActive: Boolean; { runtime only....enables joystick polling } FGamePort: TGamePort; { which game port to monitor } FEnabled: Boolean; { tells whether event is enabled } FNotifyRange: Integer; { percentage joystick move notify } FPollRate: Integer; { tells how often to check joystick in miliseconds } FRepeatPosition: Boolean; { call joymove event if same as before } FRepeatButton1: Boolean; FRepeatButton2: Boolean; FRepeatButton3: Boolean; FRepeatButton4: Boolean; FOnButton1: TButtonNotifyEvent; FOnButton2: TButtonNotifyEvent; FOnButton3: TButtonNotifyEvent; FOnButton4: TButtonNotifyEvent; FOnJoyMove: TJoyMoveEvent; LastJoyX, LastJoyY: LongInt; { remembers last joystick position } LastButton1, LastButton2: Boolean; { remebers last button positions } LastButton3, LastButton4: Boolean; FTimer: TTimer; procedure SetNotifyRange(value: Integer); procedure SetGamePort(value: TGamePort); procedure SetPollRate(value: Integer); procedure SetDefaults; { sets the default values for variables } procedure MakeTimer; { initialization of TTimer } procedure Translate(Sender: TObject); { THE routine...for joystick } procedure DoButton1; procedure DoButton2; procedure DoButton3; procedure DoButton4; procedure DoJoystick; protected { Protected declarations } public { Public declarations } constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Activate; { during runtime...enables interrupt } procedure DeActivate; { during runtime...disables interrupt } procedure Devices(var value: Word); { returns # of devices } procedure Buttons(Port: Integer; var value: Word); procedure CalibrateCenter; { current joystick position as center } procedure CalibrateUpLeft; procedure CalibrateDownRight; published { Published declarations } property Active: Boolean read FActive; property Enabled: Boolean read FEnabled write FEnabled; property GamePort: TGamePort read FGamePort write SetGamePort; property NotifyRange: Integer read FNotifyRange write SetNotifyRange default 20; property PollRate: Integer read FPollRate write SetPollRate default 50; property RepeatPosition: Boolean read FRepeatPosition write FRepeatPosition; property RepeatButton1: Boolean read FRepeatButton1 write FRepeatButton1; property RepeatButton2: Boolean read FRepeatButton2 write FRepeatButton2; property RepeatButton3: Boolean read FRepeatButton3 write FRepeatButton3; property RepeatButton4: Boolean read FRepeatButton4 write FRepeatButton4; property OnButton1: TButtonNotifyEvent read FOnButton1 write FOnButton1; property OnButton2: TButtonNotifyEvent read FOnButton2 write FOnButton2; property OnButton3: TButtonNotifyEvent read FOnButton3 write FOnButton3; property OnButton4: TButtonNotifyEvent read FOnButton4 write FOnButton4; property OnJoyMove: TJoyMoveEvent read FOnJoyMove write FOnJoyMove; end; procedure Register; implementation procedure Register; begin RegisterComponents('Addons', [TJoystick]); end; constructor TJoystick.Create(AOwner: TComponent); begin inherited Create(AOwner); SetDefaults; MakeTimer; end; destructor TJoystick.Destroy; begin DeActivate; FTimer.Free; inherited Destroy; end; procedure TJoystick.SetDefaults; begin FActive := False; Enabled := True; PollRate := 50; NotifyRange := 20; GamePort := One; RepeatPosition := True; RepeatButton1 := False; RepeatButton2 := False; RepeatButton3 := False; RepeatButton4 := False; CenterX := 32768; CenterY := 32768; DeltaNegX := 8192; DeltaPosX := 8192; DeltaNegY := 8192; DeltaPosY := 8192; end; procedure TJoystick.MakeTimer; begin FTimer := TTimer.Create(Self); FTimer.Enabled := False; FTimer.Interval := 50; FTimer.OnTimer := Translate; end; procedure TJoystick.SetNotifyRange(value: Integer); begin if FActive = False then FNotifyRange := value; end; procedure TJoystick.SetGamePort(value: TGamePort); begin if FActive = False then begin FGamePort := value; case value of One: JoyId := JOYSTICKID1; Two: JoyId := JOYSTICKID2; else JoyId := 0; end; end; end; procedure TJoystick.SetPollRate(value: Integer); begin if FActive = False then FPollRate := value; end; procedure TJoystick.Devices(var value: Word); begin value := joyGetNumDevs; if value > 2 then value := 2; end; procedure TJoystick.Buttons(Port: Integer; var value: Word); var JID: Word; JCaps: TJoyCaps; rvalue: Word; begin case Port of 1: JID := JOYSTICKID1; 2: JID := JOYSTICKID2; else JID := 0; end; rvalue := joyGetDevCaps(JID, @JCaps, SizeOf(JCaps)); if rvalue = JOYERR_NOERROR then value := JCaps.wNumButtons else value := 0; end; procedure TJoystick.CalibrateCenter; var rvalue: Word; JoyInfo: TJoyInfo; begin rvalue := joyGetPos(JoyId, @JoyInfo); if rvalue = JOYERR_NOERROR then begin CenterX := JoyInfo.wXpos; CenterY := JoyInfo.wYpos; end else begin CenterX := (JoyCaps.wXmax - JoyCaps.wXmin) div 2; CenterY := (JoyCaps.wYmax - JoyCaps.wYmin) div 2; end; end; procedure TJoystick.CalibrateUpLeft; var rvalue: Word; JoyInfo: TJoyInfo; begin rvalue := joyGetPos(JoyId, @JoyInfo); if rvalue = JOYERR_NOERROR then begin DeltaNegX := (CenterX - JoyInfo.wXpos) div FNotifyRange; DeltaNegY := (CenterY - JoyInfo.wYpos) div FNotifyRange; end else begin DeltaNegX := CenterX div FNotifyRange; DeltaNegY := CenterY div FNotifyRange; end; end; procedure TJoystick.CalibrateDownRight; var rvalue: Word; JoyInfo: TJoyInfo; begin rvalue := joyGetPos(JoyId, @JoyInfo); if rvalue = JOYERR_NOERROR then begin DeltaPosX := (JoyInfo.wXpos - CenterX) div FNotifyRange; DeltaPosY := (JoyInfo.wYpos - CenterY) div FNotifyRange; end else begin DeltaPosX := CenterX div FNotifyRange; DeltaPosY := CenterY div FNotifyRange; end; end; procedure TJoystick.Activate; var rvalue: Word; begin DeActivate; rvalue := joyGetDevCaps(JoyId, @JoyCaps, SizeOf(JoyCaps)); if rvalue = JOYERR_NOERROR then begin rvalue := joyGetPos(JoyId, @JoyInfo); { only activate if no errors returned } if rvalue = JOYERR_NOERROR then begin FTimer.Interval := PollRate; FTimer.Enabled := True; FActive := True; end; end; { if there is no device, it will remain InActive } end; procedure TJoystick.DeActivate; begin if FActive = True then FTimer.Enabled := False; FActive := False; end; procedure TJoystick.Translate(Sender: TObject); var rvalue: Word; begin { only check joystick if the component is enabled and active } if (FEnabled = True) and (FActive = True) then begin rvalue := joyGetPos(JoyId, @JoyInfo); { only evaluate if no errors returned } if rvalue = JOYERR_NOERROR then begin DoButton1; DoButton2; DoButton3; DoButton4; DoJoystick; end; end; end; procedure TJoystick.DoButton1; var Pushed: Boolean; begin if (JoyInfo.wButtons and JOY_BUTTON1) = JOY_BUTTON1 then Pushed := True else Pushed := False; if FRepeatButton1 = True then begin if (Assigned(FOnButton1)) then FOnButton1(Self, Pushed) end else { logic to NOT call button if same as last } if (Assigned(FOnButton1)) and not(Pushed = LastButton1) then FOnButton1(Self, Pushed); LastButton1 := Pushed; end; procedure TJoystick.DoButton2; var Pushed: Boolean; begin if (JoyInfo.wButtons and JOY_BUTTON2) = JOY_BUTTON2 then Pushed := True else Pushed := False; if FRepeatButton2 = True then begin if (Assigned(FOnButton2)) then FOnButton2(Self, Pushed) end else { logic to NOT call button if same as last } if (Assigned(FOnButton2)) and not(Pushed = LastButton2) then FOnButton2(Self, Pushed); LastButton2 := Pushed; end; procedure TJoystick.DoButton3; var Pushed: Boolean; begin if (JoyInfo.wButtons and JOY_BUTTON3) = JOY_BUTTON3 then Pushed := True else Pushed := False; if FRepeatButton3 = True then begin if (Assigned(FOnButton3)) then FOnButton3(Self, Pushed) end else { logic to NOT call button if same as last } if (Assigned(FOnButton3)) and not(Pushed = LastButton3) then FOnButton3(Self, Pushed); LastButton3 := Pushed; end; procedure TJoystick.DoButton4; var Pushed: Boolean; begin if (JoyInfo.wButtons and JOY_BUTTON4) = JOY_BUTTON4 then Pushed := True else Pushed := False; if FRepeatButton4 = True then begin if (Assigned(FOnButton4)) then FOnButton4(Self, Pushed) end else { logic to NOT call button if same as last } if (Assigned(FOnButton4)) and not(Pushed = LastButton4) then FOnButton4(Self, Pushed); LastButton4 := Pushed; end; procedure TJoystick.DoJoystick; var LocX, LocY: Integer; begin LocX := 0; LocY := 0; if (JoyInfo.wXpos < CenterX) then LocX := (JoyInfo.wXpos - CenterX) div DeltaNegX else LocX := (JoyInfo.wXpos - CenterX) div DeltaPosX; if (JoyInfo.wYpos < CenterY) then LocY := (CenterY - JoyInfo.wYpos) div DeltaNegY else LocY := (CenterY - JoyInfo.wYpos) div DeltaPosY; if FRepeatPosition = True then begin if (Assigned(FOnJoyMove)) then FOnJoyMove(Self, LocX, LocY) end else if (Assigned(FOnJoyMove)) and ((LocX <> LastJoyX) or (LocY <> LastJoyY)) then OnJoyMove(Self, LocX, LocY); LastJoyX := LocX; LastJoyY := LocY; end; end. i know how to activate it and how to setup in the right port That i cant handle is how to get the move option the unit have so i create a var myJoy : Tjoystick; begin myJoy := Tjoystick.Create(form1); myJoy.OnJoyMove <---- that how can i handle? end; thank you
-
Hello, I am using the default ClientRest components the provide the Delphi Community 10.3.2. I manage to get and delete a file from a json server but i can't do a post. I try to post a new user to cscart based jsonserver here is the api wiki that tells how to manipulate the API. https://docs.cs-cart.com/latest/developer_guide/api/entities/users.html I don't know how to post the data needed for creation a user. Thank you.
-
After many tries and a lot of read i found that the dbExpress components simple aren't to stable. So i change to FireDac and everything works just fine. So please do not use dbExpress components at least for Interbase Database embedded. Thank you for all the awnsers.
-
Hello.. I finally manage to success a TSQLConnection with all the required params. Before i run my program i test it and change the connection from false to true. Add the password and it connects successfully. Return to True to False propertie. Try to run my program and i get the below message Am i doing something wrong or embarcadero have some default about dbexpress components and make me drive crazy?