Recent

Author Topic: Control not showing on form  (Read 1865 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Control not showing on form
« on: February 11, 2019, 03:27:54 pm »
Trying to call a form with a dialog control, Select a Dir. When I run program the dialog control dosen't show. I addend several and a tEdit. The tEdit shows.

Example attached. 
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Control not showing on form
« Reply #1 on: February 11, 2019, 04:03:58 pm »
You did it wrong. :D

This is how you should use TSelectDirectoryDialog:

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, Forms, Controls, Dialogs, StdCtrls;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     Button1: TButton;
  16.     SelectDirectoryDialog1: TSelectDirectoryDialog;
  17.     procedure Button1Click(Sender: TObject);
  18.   end;
  19.  
  20. var
  21.   Form1: TForm1;
  22.  
  23. implementation
  24.  
  25. {$R *.lfm}
  26.  
  27. { TForm1 }
  28.  
  29. procedure TForm1.Button1Click(Sender: TObject);
  30. begin
  31.   if not(SelectDirectoryDialog1.Execute) then Exit;
  32.   ShowMessage(SelectDirectoryDialog1.FileName);
  33. end;
  34.  
  35. end.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Control not showing on form
« Reply #2 on: February 11, 2019, 04:18:49 pm »
I don't understand. In my example the TSelectDirectoryDialog control is on form2 in my example and when I run the program the control doesn't show.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Control not showing on form
« Reply #3 on: February 11, 2019, 04:25:17 pm »
I see you just have a button which runs the control.v
Ok
thanks.

FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018