Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
Beginners
(Moderators:
FPK
,
Tomas Hajny
) »
[SOLVED] Signalize from object to main form
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
FpDebug likely bug
by
Martin_fr
[
Today
at 09:10:31 pm]
Web Applications with Pas...
by
Handoko
[
Today
at 08:56:29 pm]
AI, NLP and CAI: Text Gen...
by
indydev
[
Today
at 08:54:00 pm]
Offical launch of the 1 B...
by
Gustavo 'Gus' Carreno
[
Today
at 08:48:22 pm]
Colore celle StringGrid
by
JuanBell
[
Today
at 08:47:28 pm]
Multidimensional arrays a...
by
KodeZwerg
[
Today
at 08:34:38 pm]
Ho Ho Ho IntraWeb in Laza...
by
Thaddy
[
Today
at 08:31:29 pm]
[SOLVED] System.Now gives...
by
alpine
[
Today
at 08:29:19 pm]
open dialog - default dir...
by
Nicole
[
Today
at 08:02:40 pm]
Installing and using Vamp...
by
Odacir
[
Today
at 07:58:22 pm]
Demo Scene Picture sinwav...
by
circular
[
Today
at 07:27:02 pm]
Demo Scene Bitmap Font Sc...
by
KodeZwerg
[
Today
at 07:21:14 pm]
what's difference between...
by
ASerge
[
Today
at 07:09:52 pm]
splitting an image
by
KodeZwerg
[
Today
at 07:07:21 pm]
Debugger error
by
bobonwhidbey
[
Today
at 07:03:07 pm]
How to: create DLL file f...
by
paule32
[
Today
at 07:02:31 pm]
Your best UI design - con...
by
circular
[
Today
at 06:48:12 pm]
Converting a string/index...
by
1HuntnMan
[
Today
at 06:35:19 pm]
Drawing grid lines on a t...
by
KodeZwerg
[
Today
at 05:42:19 pm]
Compile/Convert Delphi pr...
by
Martin_fr
[
Today
at 05:29:03 pm]
Lazarus features in a non...
by
Lutz Mändle
[
Today
at 05:26:34 pm]
Lazarus for Windows on aa...
by
msintle
[
Today
at 05:03:57 pm]
Parameter passing odditie...
by
KodeZwerg
[
Today
at 03:41:49 pm]
Surf Units in Text Mode I...
by
mosquito
[
Today
at 01:58:21 pm]
Generics - correct syntax
by
Thaddy
[
Today
at 01:48:32 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] Signalize from object to main form (Read 2893 times)
tudi_x
Hero Member
Posts: 532
[SOLVED] Signalize from object to main form
«
on:
September 21, 2017, 05:42:17 pm »
hi All,
as per attached i need to signalize when edit completed so i can move to next screen.
is it possible to produce an event inside the screen 1 object that would trigger procedure in main form?
thank you
Lazarus 1.8RC4 , cross platform
Code: Pascal
[Select]
[+]
[-]
unit
screen_1
;
{$mode objfpc}{$H+}
interface
uses
Classes
,
SysUtils
,
Forms
,
ExtCtrls
,
Graphics
,
Controls
,
StdCtrls
;
type
TScreen1
=
class
private
E1
:
TEdit
;
procedure
FinishInput
(
ASender
:
TObject
)
;
public
constructor
Create
(
AParent
:
TCustomForm
)
;
procedure
IsVisible
(
AVisible
:
boolean
)
;
end
;
implementation
constructor
TScreen1
.
Create
(
AParent
:
TCustomForm
)
;
begin
E1
:
=
TEdit
.
Create
(
AParent
)
;
E1
.
OnChange
:
=
@
FinishInput
;
//hook the check
E1
.
Text
:
=
'screen 1'
;
E1
.
Visible
:
=
False
;
E1
.
Parent
:
=
AParent
;
end
;
procedure
TScreen1
.
IsVisible
(
AVisible
:
boolean
)
;
begin
E1
.
Visible
:
=
AVisible
;
end
;
procedure
TScreen1
.
FinishInput
(
ASender
:
TObject
)
;
begin
if
E1
.
Text
=
'x'
then
begin
//signalize to switch to screen 2 - to run ShowScreen2
end
;
end
;
end
.
«
Last Edit: September 22, 2017, 09:16:25 am by tudi_x
»
Logged
Lazarus 2.0.2 64b on Debian LXDE 10
howardpc
Hero Member
Posts: 4144
Re: Signalize from object to main form
«
Reply #1 on:
September 21, 2017, 06:22:59 pm »
You are already using the edit's OnChange event for this.
So you can do what you want much more simply as in the attached project (if I've understood what you are after).
Logged
tudi_x
Hero Member
Posts: 532
Re: Signalize from object to main form
«
Reply #2 on:
September 21, 2017, 06:32:00 pm »
thank you but i need to stick with the objects.
please advise if it is possible to call from the (GUI) objects the main form or this is bad design.
worst case scenario i would convert the units to .inc files so they are friendly classes.
«
Last Edit: September 21, 2017, 06:40:17 pm by tudi_x
»
Logged
Lazarus 2.0.2 64b on Debian LXDE 10
howardpc
Hero Member
Posts: 4144
Re: Signalize from object to main form
«
Reply #3 on:
September 21, 2017, 07:57:50 pm »
If you want to use the objects you create, then you must free them correctly.
The standard way to communicate is via an event.
See the attached project which adds a suitable event and frees all the created instances.
Logged
tudi_x
Hero Member
Posts: 532
Re: Signalize from object to main form
«
Reply #4 on:
September 22, 2017, 09:16:11 am »
i will use the notify event for all my screens.
thank you very much
Logged
Lazarus 2.0.2 64b on Debian LXDE 10
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
Beginners
(Moderators:
FPK
,
Tomas Hajny
) »
[SOLVED] Signalize from object to main form
TinyPortal
© 2005-2018