IonicWind Software

IWBasic => General Questions => Topic started by: Bruce Peaslee on September 30, 2010, 10:09:45 PM

Title: File Request Leaves "Ghost" Image
Post by: Bruce Peaslee on September 30, 2010, 10:09:45 PM
This is a weird one. The first thing my user does is to pick a file to process. The file request dialog opens and operates as usual. Initially, after it closes, I didn't notice anything, as another dialog would open immediately and obscure the main window. However, I added a progress control just for the heck of it. It, too, works, but as the new dialog now doesn't open until the progress control closes, I can see that there is a graphical remnant of the file request dialog blocking part of an image on the main window. This looks tacky. Putting the WAIT command after the file request code solves the problem, but I don't know why.   ???

Does anyone know why?
Title: Re: File Request Leaves "Ghost" Image
Post by: WayneA on September 30, 2010, 10:59:52 PM
I imagine you didn't post the code because you don't want us to see it. I personally would just force a repaint at the time that this remnant first becomes obvious and see if that fixes it.

If you can post relevant code please do.

If the wait does it, I suspect its because you're actually getting a paint message, but without the wait its not processed.
Title: Re: File Request Leaves "Ghost" Image
Post by: Bruce Peaslee on October 01, 2010, 11:18:53 AM
'Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯
Sub wMain_FileOpen(), int
'_________________________________________________________________________________________________________________
'
'    Purpose: Select the file to open
' Parameters: -
'    Returns: @IDOK or @IDCANCEL
'      Notes: -
'
    Def sFileName as string
    Def sFilter   as string   
   
    sFilter   = "Database files|*.mdb|All Files|*.*||"
    sFileName = FileRequest("Select file to open.", wMain, 1 ,sFilter, "mdb", 0, GetStartPath())
    If sFileName = ""
        Return @IDCANCEL
    EndIf
    g_pDB = dbConnect("Microsoft Access Driver (*.mdb)", sFileName, "", wMain)
   
    If (g_pDB = null)
        MessageBox wMain, "Database failed to connect.", "Error", 0
        Return @IDCANCEL
    EndIf
   
    g_bFileOpen = true

    'For some reason, the remains of the FileRequest dialog appear in the image...
    Wait
   
    Return @IDOK
   
EndSub


Here is the exact code. I tried to repaint, which worked, but you can see the repaint as it occurs. The WAIT solves the problem. I think, too, it has something to do with the way Windows processes messages.

Thanks
Title: Re: File Request Leaves "Ghost" Image
Post by: WayneA on October 01, 2010, 03:57:50 PM
Ya I think WAITing is the perfect solution (which shouldn't be surprising, you're a great programmer!).

Looks to me that the window is getting starved without it and that causes the window to not properly update. I think theres a few messages that are needed and not just a paint - meaning (I am speculating here) the paint option would is half the answer.
Title: Re: File Request Leaves "Ghost" Image
Post by: LarryMc on October 01, 2010, 04:25:24 PM
Bruce
Do you happen to be using a @GROUP control in that area?

LarryMc
Title: Re: File Request Leaves "Ghost" Image
Post by: Bruce Peaslee on October 01, 2010, 04:43:56 PM
Quote from: Larry McCaughn on October 01, 2010, 04:25:24 PM
Bruce
Do you happen to be using a @GROUP control in that area?

LarryMc

No groups. The main window has an image and some text and the dialog that opens has 133 rich edit controls. The problem occurred after one selected a file, but before the dialog opened.

Edit: there is also a separate dialog with a progress bar that opens and moves from instructions from the initialization phase of the dialog.
Title: Re: File Request Leaves "Ghost" Image
Post by: WayneA on October 01, 2010, 05:27:18 PM
I don't really want to move this off topic, but Larry you just reminded me of something.
As you seemingly are aware, the center of a groupbox doesn't update in windows, its just kinda a dead area.

How can we use them effectively in windows.. ie like they are in dialogs?


Edited later,
http://ebasic-aurora.com/forums/index.php?topic=1777.0

Title: Re: File Request Leaves "Ghost" Image
Post by: LarryMc on October 01, 2010, 05:50:38 PM
Quote from: WayneA on October 01, 2010, 05:27:18 PM
I don't really want to move this off topic, but Larry you just reminded me of something.
As you seemingly are aware, the center of a groupbox doesn't update in windows, its just kinda a dead area.

How can we use them effectively in windows.. ie like they are in dialogs?
It's been covered in other post here on the forum.

@Bruce
I have had to use the WAIT command a few times before when I had a lot of controls and also had called a lib function that was a cpu time hog and didn't share time slices nice.

I've also had to use the INVALIDATE windows function at times also.

LarryMc