Works in Windows not in OSX - Help please

The following code works fine in Windows i.e.: the new window “nw” becomes visible when visible is set to true.

In OS X (10.9.5) The window does not become visible.

The debugger shows the window as existing and visible with coordinates on the screen.

Any ideas?

[code] Dim nw As New MainWin

nw.Visible = false

nw.QueryControl.db = ConnectionWin.Connect

if nw.QueryControl.db <> nil then

nw.Title = "Visual Data Drill (" + nw.QueryControl.db.DatabaseName + ")"

nw.QueryControl.LoadTableSchema

nw.Visible = true

else

nw.Close

end if[/code]

Dim nw As New MainWin

This part works perfectly. The nw appears.

Now since you make it invisible right away, maybe the part where you test against values in db never makes it visible ?

You may want to comment out nw.Visible = false

Thanks Michel but I have stepped through the code and the window is being set to visible and the debugger shows its visible property as true.

I can work around it but I am trying to understand why it works in Windows and not OSX. Also why the debugger does not agree with reality :slight_smile:

[quote=134172:@Peter Fargo]Thanks Michel but I have stepped through the code and the window is being set to visible and the debugger shows its visible property as true.

I can work around it but I am trying to understand why it works in Windows and not OSX. Also why the debugger does not agree with reality :)[/quote]

I don’t have your db, so I have slightly modified the code to :

[code] Dim nw As New MainWin

nw.Visible = false

'nw.QueryControl.db = ConnectionWin.Connect

if “nw.QueryControl.db” <> “” then
nw.Title = “Visual Data Drill (”
'nw.QueryControl.LoadTableSchema
nw.Visible = true
'else
'nw.Close
end if[/code]

Essentially, I simply test for a condition that will always be true. The window does become visible.

I rather trust my own eyes than the debugger.

What about nw.Title ? Is it properly set as well ? I suspect the condition in the if is not met.

A database wrapper which is valid is being returned in the if statement.

I changed the if statement to “If 1 = 1 then”

Same problem. Works on windows, not on OSX.

The debugger shows 2 copies of Main Window open and visible and there is only one visible.

The title property of the window (in the debugger) is correct.

Have you tried nw.show instead of visible=true?

what happens if you simply comment out these two lines?

[code]nw.Title = “Visual Data Drill (” + nw.QueryControl.db.DatabaseName + “)”

nw.QueryControl.LoadTableSchema[/code]

If the window becomes visible, uncomment each line in turn until you find which is the problem.

Check in the debugger to see if your window object does indeed exist. If so, check the width and height of the window you created.

It’s entirely possible you are creating a window with zero width and zero height. Yes, it’s possible. I had it happen in my app that the window sized got stored in the settings file as 0 width and 0 height. I kept running the app and getting no window. Drove me nuts until I figured it out.

[quote=134179:@Peter Fargo]A database wrapper which is valid is being returned in the if statement.

I changed the if statement to “If 1 = 1 then”

Same problem. Works on windows, not on OSX.

The debugger shows 2 copies of Main Window open and visible and there is only one visible.

The title property of the window (in the debugger) is correct.[/quote]

Here, 2014R2.1 Mavericks 10.9.5 if I go

dim nw as new Window1

A new instance of the window pops up.

I suspect the same happens in your case. Now the gremlin must be somewhere after nw.visible = false, where it is supposed to become visible.

[quote=134167:@Peter Fargo][code] Dim nw As New MainWin

nw.Visible = false

nw.QueryControl.db = ConnectionWin.Connect

if nw.QueryControl.db <> nil then

nw.Title = "Visual Data Drill (" + nw.QueryControl.db.DatabaseName + ")"

nw.QueryControl.LoadTableSchema

nw.Visible = true

else

nw.Close

end if[/code][/quote]
What if instead of setting the database stuff in the code above, you add it to the MainWin Constructor? That way, you don’t need to worry about visibility.

@Jon Ogden Done all that
@Jeff Tullin No change
@Michel Bujardet I agree that something is happening due to the modal dialog (connection window). But it is odd it only happens on OS X.
@Tim Jones and @Sam Rowlands I can make it work various ways I just find it odd that it works on Windows and not OS X.

Thanks everyone for the help. I’ll try to isolate it for a bug report or find my issue. Workaround is not hard. Sam’s is simplest so he gets the green check :slight_smile: