Topic: Message dialog for disabled field?

Is it possible to add a message pop-up for disabled field? If so how?



something like below which doesn't work:

procedure Form1_Edit1_OnClick (Sender: string; var Cancel: boolean);
begin
ShowMessage ('Custom message ....');
end;
Adam
God... please help me become the person my dog thinks I am.

Re: Message dialog for disabled field?

what do you mean Disabled?

Re: Message dialog for disabled field?

jonibek wrote:

what do you mean Disabled?


Form1.Edit1.Enabled := False;
Adam
God... please help me become the person my dog thinks I am.

Re: Message dialog for disabled field?

i dont understand your purpose, why you need to pop-up the message. Try this.
procedure Form1_Edit1_OnClick (Sender: string; var Cancel: boolean);
begin
if Form1.Edit1.Enabled = False then ShowMessage ('Custom message ....');
end;

Re: Message dialog for disabled field?

jonibek wrote:

... Try this.
procedure Form1_Edit1_OnClick (Sender: string; var Cancel: boolean);
begin
if Form1.Edit1.Enabled = False then ShowMessage ('Custom message ....');
end;


Hi jonibek,
thanks but unfortunately, it doesn't work.


jonibek wrote:

i dont understand your purpose, why you need to pop-up the message...

Please see the attached sample project below:

Post's attachments

Attachment icon Disabled Item Test.zip 5.12 kb, 349 downloads since 2017-07-31 

Adam
God... please help me become the person my dog thinks I am.

Re: Message dialog for disabled field?

AD1408 wrote:

Please see the attached sample project below:


I changed a bit the procedure. Take a look!

Post's attachments

Attachment icon Disabled Item Test_fixed.zip 326.1 kb, 347 downloads since 2017-07-31 

7 (edited by AD1408 2017-07-31 15:30:38)

Re: Message dialog for disabled field?

jonibek wrote:

I changed a bit the procedure. Take a look!


Thanks a lot for your kind help.....
I was trying to avaoid writing code for each field in the groupbox hence in actual project groupbox contains many fields. That's the main reason for looking a solution as stated on post #1, if there is one.

Adam
God... please help me become the person my dog thinks I am.

Re: Message dialog for disabled field?

May be Dmitriy can help with this case.

Re: Message dialog for disabled field?

Adam,
There's not a whole lot you can do with disabled components when it involves events. You could use popup hints but all the components would need to be set to ReadOnly and not disabled. Groupboxes cannot be set to Readonly. Each field would need to be set to Readonly. Since you said that your project would contain a lot of fields, it may not be feasible to do it this way. The closest I could come up with to do what you are looking for is attached. The combobox needs to be the first field to have focus on the form.

Post's attachments

Attachment icon Disabled Item Test Alternative.zip 581.75 kb, 363 downloads since 2017-07-31 

Re: Message dialog for disabled field?

Hi EHW,

Your approach comes quite close to original objective.
Thank you very much..............


I know, what I was trying to do against the logic. I thought there may be a trick.

Adam
God... please help me become the person my dog thinks I am.