If 6 = MsgBox doesn't stop code advance

I am having a problem with MsgBox and if statements.
If I put it in an If statement, the If statement is ignored and the code (between the if and End If) which is following is ran.
The message shows with the buttons.
This happens with debugger and built.

This started recently after 2018r2
Is anyone else seeing this?

please post the exact code in question

Hmmmm…I just tried the example from the docs using Xojo 2018R2

Dim n As Integer n = MsgBox("Do you want to rebuild this mailbox?", 36) If n = 6 Then // user pressed Yes ElseIf n = 7 Then // user pressed No End If

And it indeed is not working

Windows 10 and Windows 8.1

I will step through in debug and also try in built app

Sorry had a flaw in my test and noticed it when debugging

As dave asked could you please post the trouble code?

Just to be clear, Brian edited the post and now ‘not’ has a line in it, so the code in the example does work, right?

Edit: no problem Brian, we will wait for Arthur’s code


My fault I should have alerted to the fact that I altered my post

Sorry for not posting. I also didn’t notice the edit.
This is one example of a code block.
It consistently breaks down.

If 6 = MsgBox( "Do You Want to Update the Dictionary" + EOL + _ "This Should be Denied IF Practice Files NEED to be Processed", 36 ) Then YPrf.FOpnRun = False DictBildThrd.Run End If
This is essentially in the window’s open. I haven’t bothered to look for synchronicity of breaks, but there are others.
I also know the “_” doesn’t matter.
DictBildThrd.Run is a thread that gets called even though I haven’t selected a choice.

This also happens during a built app on Mac.

It’s on a late 2011 MacBook Pro Laptop (one of those that don’t get Mojave - grumble).

It could also be I only have the default graphics display memory of 4gig. If it’s this weird one I’ll know in a couple of days. I’m getting 16 gigs.

I just ran this using macOS and Xojo2016… replacing the Yprf code with a simple “break”
and it works

are you sure that it is in fact NOT working… or that the code inside the IF/ENDIF is what is not working?

put a breakpoint on the YPRF line

Working to me means the MsgBox waits until I answer Yes or No.

The code goes on whether I have pressed a button.

[quote=411199:@Arthur Gabhart]Working to me means the MsgBox waits until I answer Yes or No.

The code goes on whether I have pressed a button.[/quote]
not the behavioiur you infered was occuring… in which case I’d put a breakpoint on the IF… to prove it is even getting there as you assume

Here’s an image of what happens

sorry forgot how to do images

and how is that “wrong”?

I haven’t pressed a button.
It is inside the If statement which means it doesn’t get executed in this case until a yes button is pressed.

just for giggles and laughs… switch the statement.

first try

if msgBox(.....) = 6 THEN 

if that doesn’t work try

dim xxx as Integer=msgbox(.....)
if x=6 then 

and I’m worried that you hit your break… yet the msgbox is STILL Visibile?

Arthur, how you define EOL on your program?

EOL is a computed property

#If TargetWindows Then Return &u0d// + &u0a//EndOfLine.Windows// #ElseIf TargetLinux Or TargetMacOS Then Return &u0a// EndOfLine.UNIX #EndIf

About the MsgBox showing. I agree it is weird.
Another weirdness.
For some reason there are problems with modal dialogs and the debugger.

This is going to a selectFolder dialog and if I leave off “Within(self)”

    TempFolderItem = dlg.ShowModalWithin(self)

the code hangs if I’m going into a breakpoint in the dialog.

EOL does not have to be a “computed property”… just use ENDOFLINE
the compiler knows what the right value is

I know. Thanks. For some reason Split wasn’t working and I made it that way.
Split Probably has been fixed, but it’s faster to type EOL than EndOfLine.

If this sounds like memory display problems, I’ll repost after I get more memory.

It does not…