azrael_11
Members-
Content Count
69 -
Joined
-
Last visited
Everything posted by azrael_11
-
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?
-
Maybe misunderstood what i write or i write completely wrong. Let me be more specific. function Tfrm_custom_debug_info.RunCommand(Command: String): Boolean; var full: string; begin full := '/C '+ Command; ShellExecute(0, nil, 'cmd.exe', PChar(full) , nil, SW_HIDE); Self.Close; end; 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. Get a list of all DELPHI IDE that running Somehow when i execute the function above open the .pas file in the DELPHI IDE i want choose from the list i get above. I think now be more specific. Thank you
-
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.
-
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,
-
Hello ... Try to add video files with TMediaPlayer and TMediaPlayerControl and always get "unsupported media file" for any video file type like *.avi, *.wmv or *.mp4. I install the latest K-Full media codecs and the problem remains the same. Anyone has some experience about TMediaPlayer? P.S. Even the MediaPlayerHD example provided from delphi not working. 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 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? -
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 -
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
-
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
-
Thank you very much for all the help. If you have and html sites to read about md5 or sha1 or crc i appreciate.
-
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
-
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 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?
-
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.
-
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?
-
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.
-
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
-
Ok i found it the right one is csCart.main.Grid.InsertObject(vi, TStringColumn.Create(csCart.main.Grid));
-
Try to connect to cscart Rest API Server The documentation here says that Uses Basic HTTP authentication so but the e-mail and the api-key must encode to base64 encoder. So i encode the email and api and try with the rest tool that embracedero provides. I add in the authentication tab the basic and in user name the encoded with base64 email and in the password the encoded with base64 Apikey. And returns that