vcl

Form doesn't get updated

In my application (Main form is TTntForm, C++Builder 2006): void __fastcall TForm1::Button1Click(TObject *Sender) { Caption=L"1st caption"; // This works. Form1->Caption=L"2nd caption"; // But this doesn't work, // Caption of the form remains "1st caption". } What might be the cause of this ...

Skins in delphi7

I wish to skin my aplication and have noticed that there appears to be no obvious way to do this. I am used to skinning files for java and wondered if there was any way of changing the appearance of the "standard" delphi7 application. Edit:(taggs) ...

How to add mouse wheel support to a component descended from TGraphicControl?

I have created a delphi component which descends from TGraphicControl. Is it possible to add support for mouse wheels? --- Edit --- I've exposed the MouseWheel events as shown below but they aren't called. TMyComponent = class(TGraphicControl) published property OnMouseWheel; property OnMouseWheelDown; property OnMouseWheelUp; ...

Why Do Some Delphi Components Require "AOwner: TComponent" To Construct Them?

It seems completely irrelevant to require a TComponent as an owner to instantiate an object of some kind. Why are there so many Delphi components that require this? For example, TXMLDocument requires a TComponent object to instantiate. Why is this and if there's a good reason, what should I be using in there to "do the right thing"? ...

Delphi form creation without freezing main thread

Hello everyone. I am having trouble with something i wanna do. I have some big forms which take some time to create. To make the app load faster i thought of letting the forms be created in a thread which is created at main form's OnCreate event. The thread has a FApplication field of type TApplication which obviously is the Application...

Why do my Borland C++Builder 5 forms with right-anchored controls appear incorrectly on Vista?

Having spent a small age looking for the solution and having now found it, I figured this would be good to document for Stack Overflow. So my answer will follow right after this question. I was using Borland C++ Builder 5. This probably also applies to the equivalent version of Delphi. I had a form with a TButton on a TPanel. The bu...

How to change behaviour of TDBNavigator component?

Hi, I would like to change the behaviour of the insert button on the standard DBNavigator bar, from a dataset insert to append. I could trap the button click in the BeforeAction event, do the append, etc; and then in the OnClick event abort the original insert, but this seems a bit of a hack. Any better ideas? I'm using D6 (500,000 km...

When is TGraphicControl.Paint called?

I'm trying to write a custom TGraphicControl descendant that will allow a user to embed a SDL rendering surface on a VCL form. This will provide a simple way to display SDL animations in a form. Apparently a TGraphicControl is redrawn with the Paint method. How often does this get called? Is it only when something happens to invalida...

Why shouldn't you use a handle during component creation or streaming?

I want to make a custom VCL control that wraps a SDL rendering surface via the SDL_CreateWindowFrom function. SDL_CreateWindowFrom takes an existing HWND handle and puts a high-performance rendering context (it has several backends available, including DirectX and OpenGL) onto it. The helpfile says "Do not refer to the Handle property ...

How to disable closure of the main form in Borland C++

When closing an application on close button (FormClose handler is called), there is a dialog if user is sure that he wants to close the application. If the result of the dialog is mrCancel, then I try to set the ModalResult of a main form to mrNone like I do with other forms, but even though, the application still closes. What is th...

Delphi drag images challenge

Hi all, The code below enables a control (a label for instance) to show drag images while the dragging operation. My problem is that I do not want to show the drag image instanly when the dragging begins, I want the image to be displayed when the mouse is on specific boundaries of the control - eg. in the right half of the label . S...

Hide the Main Form in a Delphi 2009 Application

Hi, The following code works fine in Delphi 7. However, in Delphi 2009 the form does remain hidden but the button on the taskbar is now appearing. ShowWindow(Handle, SW_HIDE); SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW ); ShowWindow(Handle, SW_SHOW); The above code is called in the FormC...

Is there a way to locate unused event handlers in Delphi?

Finding dead code in Delphi is usually real simple: just compile and then scan for routines missing their blue dots. The smart linker's very good about tracking them down, most of the time. Problem is, this doesn't work for event handlers because they're published methods, which (theoretically) could be invoked via RTTI somehow, even t...

C++ Builder [C++ Error] sysmac.h(58): E2040 Declaration terminated incorrectly

I want to create a C++ Builder DLL project that doesn't use VCL. But I get this error in sysmac. Does anyone know the possible cause of this error? ...

How do I port code for Borland C++ builder to Linux?

I have source code for a Windows DLL that is written in C++ and uses Visual Component Library. Now my task is to port that to Linux, but I don't have source code for the VCL itself, or any kind of documentation (and I have never worked with Borland C++; in my Windows days I used MFC). This should not be all that hard, since my DLL does ...

Delphi - Using the TApplicationEvents OnShortCut event to detect Alt+C key presses

I am using TApplicationEvents OnShortCut event to get application keyboard short cuts in a Delphi program. Using the following code: procedure TForm1.ApplicationEvents1ShortCut(var Msg: TWMKey; var Handled: Boolean) ; begin if (Msg.CharCode = VK_F9) then begin ShowMessage('F9 pressed!') ; Handled := True; end; end; ...

How do I catch the click event of a button who has a TDBGrid as its parent?

I have a small button I want to add to the top left corner of a Delphi TDBGrid component (in the header/title cells). I am able to place the button easily, but now the click event is not handled. I'm guessing the event is being caught by the grid. Any way I can force this specific event to go to the button instead? Note I still need the ...

how can i hide TRibbon pages?

i'm using delphi 2009's TRibbon component. certain pages are not relevant depending on the application state. how can i hide a TRibbon page? RibbonPage1.Visible:=false doesn't really hide the page... is this maybe not allowed by the spec from microsoft? thank you for you help! mp ...

TMonthCalendar of delphi - disable the buttons

Hi my name is carlos Im from Brasil. Is it possible to disable the buttons that change the date on the TMonthCalendar(vcl native)? thanks a lot carlos ...

Delphi - How do I fix this strange TGrid behaviour?

Delphi 2007. I have a TGrid with more rows than will fit on the screen, and the height of the grid is such that there is a partially drawn row at the bottom. When I click on this partial row, it jumps up to be fully visible (via a procedure called 'ClampInView' in Grids.pas). But it doesn't stop. Since the mouse is now over a new partia...