'Ghost' display of control content in the upper left corner of main screen

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

'Ghost' display of control content in the upper left corner of main screen

Post by ic2 »

I've seen this recently as well, as far as I know for the first time and now I got it again. I have a DataDialog with a comboboxEx on it. I wanted it to drop down on opening the window for which I already created some code which I didn't immediately realize. Anyhow, I found this line and put it in the PostInit:

Code: Select all

	SendMessage(SELF:oDCcbox:Handle(),CB_SHOWDROPDOWN,1,0L)
What happens is that the content which should be displayed within the dropped down combobox displays as a kind of ghost image in the upper left corner of my main screen. See image, I added SomeName twice for this picture and put the real window next to the "ghost content' but if the real window opens in another monitor the 'ghost' window is still in the main monitor. As soon as I click somewhere in the screen, or issue a Setfocus or something, the "ghost window" disappears (and the window with the combobox opens normally.
ComboboxContent.jpg
ComboboxContent.jpg (37.68 KiB) Viewed 861 times
What could cause this?

Dick
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

'Ghost' display of control content in the upper left corner of main screen

Post by FFF »

No idea - but isolate the window with the dialog in a new app and if the problem reproduces, send it to Chris.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
TerryB1
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

'Ghost' display of control content in the upper left corner of main screen

Post by TerryB1 »

Hi Dick

I can't be sure, but it looks to me as though, by putting that line in the PostInit you have shifted the display co-ordinates.

My reason for saying this is that the x,y co-ordinates relate to your screen (in pixels). What you see on screen
will always be related to the
Top Left screen co-ordinates, (0,0).

By including that line in the PostInit you are adding the combo box, then telling the DataDialog to manifest itself
1 unit right of 0, and 0 down. (The unit is probably pixels. Can't be sure about this, but in any event it is NOT 0,0 where it should be.

So the problem is not showing a ghost, but not overwriting the entirety of a control.

I hope this makes some sense. I know it's a bit of a brain teaser.

You could just check if what I am saying is correct by changing the line to:
SendMessage(SELF:oDCcBox:Handle(),CB_SHOOWDROPDOWN, 0, 0L)

Terry
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

'Ghost' display of control content in the upper left corner of main screen

Post by ic2 »

Hello Karl, Terry,

Thanks for your replies. I first tried to change wParam of SendMessage from 1 to 0. This resulted in the combobox no longer expanding at all. And I think I have not much other choices than to put in the postinit (as written, I have another solution which works).

Then I added a DataDialog with a combobox to a simple test app and indeed, the ghost window appears there too.

I will send it to Chris to see if we can find the cause. I have the same issue in an X# solution where I show a WebView2 in a Custom control so if Chris can find out what happens it will probably solve that issue too.

Dick
TerryB1
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

'Ghost' display of control content in the upper left corner of main screen

Post by TerryB1 »

Hi Dick

Maybe it's the order in which you are doing things. If your Combo-Box is meant to show on the Dialog Window, you must add it after.

Terry
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

'Ghost' display of control content in the upper left corner of main screen

Post by FFF »

ic2 wrote:...And I think I have not much other choices than to put in the postinit..
FTR, as there's no guarantee what may happen between a Postinit and the final Show ;) i used to add such things in my Show().
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
TerryB1
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

'Ghost' display of control content in the upper left corner of main screen

Post by TerryB1 »

Hi Dick

I am a bit puzzled as to why you do things this way. If the control is intended to be on the Dialog it should be initialised within the window itself. i.e its Init method. Correct ordering follow automatically and the offending line would not be required.
Maybe I'm misunderstanding something.

Terry
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

'Ghost' display of control content in the upper left corner of main screen

Post by ic2 »

Hello Terry, Karl,

I emphasize that I later found a solution created earlier which actually works. So getting it to work is not the real issue.

I am however puzzled while this line of code has such a weird effect, as I found this in the comp.lang NG as a way to just auto-expand the combobox. The way I see it is that the comobox is already initialized in the init and hence the SendMessage should do just that job when issues in the postinit. I also wonder what actually happens as the system is painting outside the control and I have another such situation in a completely different situation in an X# program.

As this is probably easy to follow for an expert like Chris, I sent him that basic sample and I will certainly report back his findings. And hopefully it helps me solve the X# issue as well.

Dick
TerryB1
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

'Ghost' display of control content in the upper left corner of main screen

Post by TerryB1 »

Have you tried increasing the width? See what happens.
Terry
User avatar
Chris
Posts: 4900
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

'Ghost' display of control content in the upper left corner of main screen

Post by Chris »

Hi Dick,

Nobody is more of an expert in this area than Karl-Heinz!

I agree with what the other guys said, it's a problem of trying to drop down the combo box, before it is shown.and windows receives a message at a time it does not expect it to, and gives this weird, semi-random behavior. I think this specific behavior has to do with the implementation details of the control, as I assume the drop down part of the combobox is implemented as a separate window which is disaplayed by windows on top of the owner window of the control, but then you try to show this before the owner window is shown and all hell breaks lose..

You definitely need to do this after the window is being shown, but not sure exactly when is the right time. Before looking further into it, you said you have already found a solution. Which is that?

.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply