Recent

Author Topic: old version of pascal:About create a new window  (Read 4207 times)

7vinbaby

  • Jr. Member
  • **
  • Posts: 59
  • Hi ! Bless you have a good day.
old version of pascal:About create a new window
« on: October 10, 2016, 03:15:05 pm »
I am trying to create a new window at the bottom of my screen but not the normal size .
So i am confused how can i create a window with the size and position what i want?

Just use the silly method to try one by one or some better method?
« Last Edit: October 10, 2016, 03:24:14 pm by 7vinbaby »
7vinbaby

7vinbaby

  • Jr. Member
  • **
  • Posts: 59
  • Hi ! Bless you have a good day.
Re: old version of pascal:About create a new window
« Reply #1 on: October 10, 2016, 03:22:03 pm »
Also , if i want to create a set of coloured circle ,how should i get the coordinate?
« Last Edit: October 10, 2016, 03:24:32 pm by 7vinbaby »
7vinbaby

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: old version of pascal:About create a new window
« Reply #2 on: October 10, 2016, 06:11:07 pm »
You could adapt the following to your needs (drop a button on the main form of a new Lazarus project, rename it, and complete as follows):

Code: Pascal  [Select][+][-]
  1. unit main2ndWindow;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Forms, StdCtrls;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     ShowFormButton: TButton;
  16.     procedure ShowFormButtonClick(Sender: TObject);
  17.   end;
  18.  
  19. function NewScreenBottomWindow(aWidth, aHeight: integer): TForm;
  20.  
  21. var
  22.   Form1: TForm1;
  23.  
  24. implementation
  25.  
  26. function NewScreenBottomWindow(aWidth, aHeight: integer): TForm;
  27. var
  28.   sh: integer;
  29. begin
  30.   Result:=TForm.CreateNew(Application);
  31.   sh:=Screen.Height;
  32.   if (aHeight > sh) then
  33.     aHeight:=sh;
  34.   with Result do begin
  35.     SetInitialBounds(0, sh - aHeight, aWidth, aHeight);
  36.     Caption:='Secondary';
  37.     Show;
  38.   end;
  39. end;
  40.  
  41. {$R *.lfm}
  42.  
  43. { TForm1 }
  44.  
  45. procedure TForm1.ShowFormButtonClick(Sender: TObject);
  46. begin
  47.   NewScreenBottomWindow(200, 150);
  48. end;
  49.  
  50. end.

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: old version of pascal:About create a new window
« Reply #3 on: October 10, 2016, 06:14:03 pm »
This is related to other post, sorry  :-[

AFAIK you can't.

But you can define

var
arr: array of integer;

and then

SetLength(arr, n);
« Last Edit: October 10, 2016, 07:08:04 pm by lainz »

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: old version of pascal:About create a new window
« Reply #4 on: October 10, 2016, 06:18:32 pm »
@lainz:
one recent post up   ;D

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: old version of pascal:About create a new window
« Reply #5 on: October 10, 2016, 06:53:16 pm »
@lainz:
one recent post up   ;D

Haha, It happens to me when I'm logged out of the forum and then log in, it doesn't keep the window I'm reading, and maybe I open some more windows, maybe I must keep logged in always  :D

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: old version of pascal:About create a new window
« Reply #6 on: October 10, 2016, 11:13:31 pm »
Haha, It happens to me when I'm logged out of the forum and then log in, it doesn't keep the window I'm reading, and maybe I open some more windows, maybe I must keep logged in always  :D
Well it would be kinda cozy to have you logged in 24/7  :D ... and. it is good for your "Most Time Online" stats as well  :-X

 

TinyPortal © 2005-2018