[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Problem with dropdown RxLib components and D6

Posted on 2002-05-27
5
Medium Priority
?
728 Views
Last Modified: 2012-08-14
I'm using D6 with RxLib. I set up my forms to respond to Esc key with closing:

procedure TForm2.FormKeyPress(Sender: TObject; var Key: Char);
begin
    if(Key = #27) then
    begin
      Key := #0;
      Close;
    end;
end;

It works properly, but when RxLib dropdown component (for instance RxLookupEdit or DBDateEdit) is dropped down and the user presses Esc, he gets the error with the message: 'Cannot focus a disabled or invisible window'.
It does not happen with Delphi dropdown components.

0
Comment
Question by:shrldu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7036899
maybe you should first closeup the dropped list and the close your form like


procedure TForm2.FormKeyPress(Sender: TObject; var Key: Char);
begin
   if(Key = #27) then
   begin
     Key := #0;
     if (activecontrol is trx...) then
       trx...(activecontrol).closeup;  //or similar method to close the list
     //maybe an application.processmessages is needed here
     Close;
   end;
end;

meikl ;-)
0
 

Author Comment

by:shrldu
ID: 7036929
So fast response, thanks!
I tried it but CloseUp is protected. Can I cope with it? Or what else can do that?
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 400 total points
ID: 7036938
well, no delphi on hand yet,
so i can't look a bit deeper
to the ascendors

at least you can crack protected methods
with a little trick like

//add this into your formunit
//with meaningfull replacements, of course ;-)
type
  tcrackclass = class(ClassNameWhichShouldBeCracked);

now you can access protected methods by typconversion to the tcrackclass

like

procedure TForm2.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if(Key = #27) then
  begin
    Key := #0;
    if (activecontrol is ClassNameWhichShouldBeCracked) then
      tcrackclass(activecontrol).closeup;  //access protected method
    //maybe an application.processmessages is needed here
    Close;
  end;
end;

maybe i can this evening look a bit closer,
if not solved until then

meikl ;-)
0
 
LVL 4

Expert Comment

by:nestorua
ID: 7037480
HI,
Use PopupCloseUp method instead of CloseUp.
TRxLookupEdit is inherited from TCustomComboEdit which has that method in protected section.
You can try to send the message CBN_CLOSEUP.
Sincerely,
Nestorua.
0
 

Author Comment

by:shrldu
ID: 7037724
Nestorua,

You are right, but the same problem is also with TRxDBLookupCombo where I had to use CloseUp and the trick provided by kretzschmar.

There is also additional problem that Delphi dropdown components after the first Esc close up, and the second Esc closes the form, while with the method implemented with kretzschmar and your help the form is closed immediately...

Thanks

0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question