Recent

Author Topic: SDL2 Events [SOLVED]  (Read 435 times)

Pe3s

  • Hero Member
  • *****
  • Posts: 590
SDL2 Events [SOLVED]
« on: November 28, 2024, 09:11:23 am »
Hello, I moved the procedure to a separate module
and there was an error with the Close function. Self.Close also does not work.
How can I solve this ?

Code: Pascal  [Select][+][-]
  1. procedure TSDLImageViewer.ProcessSDLEvents;
  2. begin
  3.   while SDL_PollEvent(@SDLEvent) <> 0 do
  4. begin
  5.   case SDLEvent.type_ of
  6.   SDL_DROPFILE:
  7.     begin
  8.       HandleDropEvent(SDLEvent.drop.file_);
  9.       SDL_free(SDLEvent.drop.file_);
  10.     end;
  11.   SDL_QUITEV:
  12.     begin
  13.       Close;
  14.     end;
  15.   end;
  16.   end;
  17. end;      
  18.  

Code: Pascal  [Select][+][-]
  1. core.pas(124,7) Error: Wrong number of parameters specified for call to "Close"
  2. file.inc(481,11) Error: Found declaration: Close(var File);
  3. text.inc(162,11) Error: Found declaration: Close(var Text);
  4.  
« Last Edit: November 29, 2024, 08:46:49 am by Pe3s »

ackarwow

  • Full Member
  • ***
  • Posts: 127
    • Andrzej Karwowski's Homepage
Re: SDL2 Events
« Reply #1 on: November 28, 2024, 09:19:41 am »
Hello, I moved the procedure to a separate module
and there was an error with the Close function. Self.Close also does not work.
How can I solve this ?

Code: Pascal  [Select][+][-]
  1. procedure TSDLImageViewer.ProcessSDLEvents;
  2. begin
  3.   while SDL_PollEvent(@SDLEvent) <> 0 do
  4. begin
  5.   case SDLEvent.type_ of
  6.   SDL_DROPFILE:
  7.     begin
  8.       HandleDropEvent(SDLEvent.drop.file_);
  9.       SDL_free(SDLEvent.drop.file_);
  10.     end;
  11.   SDL_QUITEV:
  12.     begin
  13.       Close;
  14.     end;
  15.   end;
  16.   end;
  17. end;      
  18.  

Code: Pascal  [Select][+][-]
  1. core.pas(124,7) Error: Wrong number of parameters specified for call to "Close"
  2. file.inc(481,11) Error: Found declaration: Close(var File);
  3. text.inc(162,11) Error: Found declaration: Close(var Text);
  4.  

Hi,

Maybe you need to pass your form as input parameter of the procedure: TSDLImageViewer.ProcessSDLEvents(aForm: TForm) and then change Close to "aForm.Close";

Pe3s

  • Hero Member
  • *****
  • Posts: 590
Re: SDL2 Events
« Reply #2 on: November 28, 2024, 09:30:47 am »
I tried with Halt(0) works a le whether it is a good idea.

One more question
How does the mode invoke Application.OnIdle := from a separate module ?

 

TinyPortal © 2005-2018