azrael_11
-
Content Count
69 -
Joined
-
Last visited
Posts posted by azrael_11
-
-
8 hours ago, PeterBelow said:If you double-click on a file in Windows Explorer that is the active application, so if you have more than one Delphi instance running none of them is active and which one is handed the file probably depends on which one the BDSLauncher app registered as "server" for .pas files finds first. You have no control over that, so do not open the file by double-click, drag it to the IDE instance you want to use to open it.
The main reason to seek which Delphi IDE have the "control" to open files is not the double clicking. Is that when i am inside the project i made when i open a form then i get the class name and make with a key compination like ctrl+F1 to open the .pas file of the form.
But when i have two Delphi IDEs open i cant sent it to open in the specific IDE to open instead that it opens in the last instance of Delphi IDE.
Is there anyway to open this file at runtime from the specific Delphi IDE that i want and not the last one that opens?
Thank you.
-
How can i take a list of opened Delphi IDE and which one is the active when i do a double click in a .pas file?
-
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,
-
On 5/1/2021 at 8:32 PM, Hobo said:Download K_Lite_Codec pack and install. Either of the three variants will work.
Be certain you have: OpenDialog1->Filter = TMediaCodecManager::GetFilterString();
included.
After 2 year ago and i have found no solution ... always get " unsupported media file "
-
20 hours ago, Remy Lebeau said:I would suggest saving the TForm itself rather than each of its child components individually.
I think this is the best way. Thanks
-
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
-
7 hours ago, Bill Meyer said:This may be worth exploring:
https://torry.net/quicksearchd.php?String=joystick&Title=YesI 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.
-
9 minutes ago, Remy Lebeau said:Then you are just going to have to debug the code at runtime to find out what is really happening. The OnJoyMove event is fired by an internal TTimer that calls joyGetPos() at regular intervals and then compares the latest coordinates and button states for any changes from the previous call. The fact that you get the OnJoyMove event fired at least once means the timer is running and polling correctly. So either you are doing something to block that timer from firing again, or maybe you are deactivating the TJoystick without realizing it, or maybe joyGetPos() itself is failing. We can't debug for you, because we can't see your real code.
FWIW, manually polling the hardware at regular intervals is not the best way to go. Makes me wonder why TJoystick was not written from the beginning to use joySetCapture() instead to allow the OS to send its own event notifications to the app.
No, this is likely not related to FMX at all - unless FMX TTimer is broken.
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
-
3 minutes ago, Attila Kovacs said:No. The event OnJoyMove should triggered every time you move the joystick, not just one time. There must be something else.
Yes it triggered only one time hmmm
Is there a change to have problem that i use FMX platform.
-
1 hour ago, Attila Kovacs said:procedure TForm1.MyOnMoveHandler(Sender: TObject; var X, Y: Integer); begin DoSomething(x, y); end; procedure TForm1.X; begin myJoy := Tjoystick.Create(Form1); myJoy.OnJoyMove := MyOnMoveHandler; end;
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?
-
-
-
Ok i found it the right one is
csCart.main.Grid.InsertObject(vi, TStringColumn.Create(csCart.main.Grid));
-
Try to add columns to Tstringgrid at run time with the code below
var vStringColumn: TStringColumn; for vi := 0 to 15 do begin csCart.main.Grid.InsertObject(vi, TStringColumn.Create(vStringColumn)); ... end;
But i get abstract error ...
What i am doing wrong?
I use Delphi 10.3.2
-
I download and install successfully the new 10.3.2 Delphi CE
Start a new VCL program
Add a Stringgrid and load some data inside.
Every ok in that stage.
When i try to click inside the grid or in the column or everywhere inside the stringgrid i get the forbitten icon and i can't do anything.
Did i miss something here or is a bug to new CE edition?
-
On 7/23/2019 at 1:27 PM, Attila Kovacs said:try a decent API tester like https://www.soapui.org/
Thank you i ll try this.
-
Try the Inline passing in the URL .
I set the correct username and api key.
In the browser everything works just fine it ask me if i want to see this content with the current username i press ok and json with response is here.
In the rest debugger i do the same but it returns anauthorised.
Any help please
List of open delphi IDE
in Windows API
Posted
Maybe misunderstood what i write or i write completely wrong.
Let me be more specific.
I have this function in my code.
the command which is string is the full path of a .pas file.
when the program is in runtime and run this function the .pas file opens in the last Delphi IDE i open.
What i want to do here is.
I think now be more specific.
Thank you