Recent

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

JLWest

  • Sr. Member
  • ****
  • Posts: 375
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. 
JLWEST 
 FPC 3.0.4, Lazarus IDE v1.8.2 Windows 10 Pro
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig 1.5 Terabyte SSD
3 Terabyte conventional disk space.

Handoko

  • Hero Member
  • *****
  • Posts: 2856
  • 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

  • Sr. Member
  • ****
  • Posts: 375
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.
JLWEST 
 FPC 3.0.4, Lazarus IDE v1.8.2 Windows 10 Pro
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig 1.5 Terabyte SSD
3 Terabyte conventional disk space.

JLWest

  • Sr. Member
  • ****
  • Posts: 375
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.

JLWEST 
 FPC 3.0.4, Lazarus IDE v1.8.2 Windows 10 Pro
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig 1.5 Terabyte SSD
3 Terabyte conventional disk space.