Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6570343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:44:41+00:00 2026-05-25T14:44:41+00:00

As is sometimes usual in visual applications, I have some code where data is

  • 0

As is sometimes usual in visual applications, I have some code where data is maintained in a visual component (a TTreeView component). I’m refactoring the code and creating unit tests for the logic.

The only visual form in my test project is the GUITestRunner. In the future I plan to run the tests as a console application under a continuous integration server, so I won’t have any form.

When I try to create a TTreeView widget without a parent and use it, I get the following error:

Control '' has no parent window

What’s the best way to create the widget on my test suite SetUp method and destroy it in the TearDown? Is it possible to use a visual widget in a console application? I don’t need to display it, or even process events. I just have to create child nodes and access the data.

I managed to make it work with an ugly hack, but I’d like to know if there is some standard practice.

Sure, in my sunny and distant future, I’ll refactor the code of this 21 thousand lines form, all my data will be in beautiful data structures and these kind of tests won’t be necessary, but now I need it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:44:42+00:00Added an answer on May 25, 2026 at 2:44 pm

    You need to create a hidden (i.e. non-visible) window to be the parent. Here is a sample console app that proves that this approach works.

    program HiddenWindow;
    
    {$APPTYPE CONSOLE}
    
    uses
      SysUtils, Forms, StdCtrls;
    
    var
      Form: TForm;
    
    begin
      Form := TForm.Create(Application);
      with TListBox.Create(Form) do begin
        Parent := Form;
        Items.Add('test');//fails if the parent is not set
      end;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes I need to quickly extract some arbitrary data from XML files to put
Sometimes I have to work on code that moves the computer clock forward. In
Sometimes you have to write some of your queries in native SQL rather than
I have a Linux test server in which sometimes the code of a system
sometimes there are sites that have some small information window thats always visible when
Sometimes a labeled break or continue can make code a lot more readable. OUTERLOOP:
Sometimes we deploy applications behind customer firewall and we need read only access to
We have a Service that continuously collects sensor data on the phone. This service
So i have a database where there is a lot of data being inserted
Sometimes the spaces get URL encoded to the + sign, and some other times

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.