May 10, 2024, 02:42:37 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


File Request Leaves "Ghost" Image

Started by Bruce Peaslee, September 30, 2010, 10:09:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bruce Peaslee

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?
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

WayneA

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.
99 little bugs in the code,
99 bugs in the code,
Fix one bug,
Compile again,
104 little bugs in the code...

All code I post is in the public domain.

Bruce Peaslee

'Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯Ã,¯
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
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

WayneA

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.
99 little bugs in the code,
99 bugs in the code,
Fix one bug,
Compile again,
104 little bugs in the code...

All code I post is in the public domain.

LarryMc

Bruce
Do you happen to be using a @GROUP control in that area?

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Bruce Peaslee

October 01, 2010, 04:43:56 PM #5 Last Edit: October 01, 2010, 04:48:58 PM by peaslee
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.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

WayneA

October 01, 2010, 05:27:18 PM #6 Last Edit: October 01, 2010, 06:34:36 PM by WayneA
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?



99 little bugs in the code,
99 bugs in the code,
Fix one bug,
Compile again,
104 little bugs in the code...

All code I post is in the public domain.

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library