0
votes

I have a Windows console app created with Embarcadero XE 6 (in fact converted from a Borland C++Builder5 project). It has a single form with a few buttons and edit controls. All these controls have set TabStop=True and appropriate TabOrder's. However, pressing Tab in runtime when the form is shown does not do anything (it just produces a sound when a cursor/focus is in an Edit control and does nothing when a button is focused).

I have read in docs that Tab order would not work unless the Parent of the form is set. However, this is the only VCL form (the other windows are the console and the GLUT window), so there is no VCL parent AFAIK. I tried to set

Parent=Application->MainForm;

in the Form's constructor, but the Application->MainForm is also NULL. Any ideas?

1
Do you have a message loop?David Heffernan
I don't have my own custom message loop. I create the form in the following way: MyForm=new TMyForm(Application); MyForm->Show(); and that's it. I also have handlers for OK and Cancel buttons that do everything I need.dolphin
Where did you get a copy of Borland XE6? Borland sold Delphi several years ago, and is now defunct. If you have a copy of Borland XE6, it's probably worth enough money to allow you to not have to write code any longer. :-)Ken White
@KenWhite Indeed, XE versions are sold by Embarcadero, yet they did not change dramatically from 1999 Borland C++ Builder 5 :-)dolphin
@dolphin: Delphi and C++Builder have changed dramatically since 1999. New IDE, new RTL/VCL, new language features, new compilers.Remy Lebeau

1 Answers

0
votes

Your problem is that you don't have a message loop. This is because console applications are not expected to have windows and do not come with message loops by default.

You can run a message loop by calling:

Application->Run();

However this will probably stop the console part of your application from working properly. How can your main thread service the console synchronously and the asynchronous GUI message loop at the same time?

I suspect you will need to have a more serious re-think of your application design.


Regarding your update, it seems that you do have a message loop, but it is the message loop for the GLUT framework. The VCL framework requires its message loop to handle dialog messages like TAB key presses.

It's plausible that running the VCL message loop in place of the GLUT message loop would give better results. But it's quite likely that would just break the GLUT part of the app.

Trying to run two incompatible GUI frameworks out of a single message loop is hard to get right. There's probably no quick fix here. You'll need to dig deeper. Perhaps it would be best to give up on the VCL and stick to the one GUI framework.