Source Code Project Mantis - FSSCP
View Issue Details
0001780FSSCPFREDpublic2008-09-27 08:272012-06-25 02:47
Assigned ToGoober5000 
PlatformOSOS Version
Product Version3.6.9 
Target VersionFixed in Version 
Summary0001780: FRED error message boxes have no size limit
DescriptionIn short, if an error occurs on mission load, saving or checking the mission with FRED's internal checking function, message boxes will describe the various errors, like missing events, unknown even names etc.
Problem is.. FRED tends to put the entire problematic event into this message box and if the even is large, the box doesn't fit to the user's screen and the actual problem description and the OK Cancel buttons are out of the user's reach.
This should be fixed somehow by limiting those boxes' size and adding a vertical scrollbar instead.
TagsNo tags attached.
duplicate of 0002658resolved Goober5000 Error messages too long to fit on the screen 
Attached Files? Borked.fs2 (4,688) 2009-05-01 07:17
diff Mantis1780diff.diff (3,050) 2009-05-08 07:30

2009-04-01 17:39   
I took a look at this but the messagebox class doesn't appear to have the ability to add scrollbars. So either we find a similar MFC class that does or we'd have to roll our own.
2009-04-01 18:08   
What about a simple standard form opened as a dialogue instead?
This error stuff is simply too complex for a standard message box. It's disigned for very short messages only.

A standard dialogue can be written which basially looks exactly like the message box but can have a maximum size, e.g.

This is simply a very annoying thing right now because if you have a very large SEXP node which is displayed as an error in such a box, you effectively have no chance to get that message box off the screen.
2009-04-11 07:30   
Or even easier.. clamp the error message to a maximum size. I mean the FREDer can go and look into the SEXP node once made aware of a problem. The message box doesn't need to display the entire gigantic SEXP node.
This would be easier to code and it would solve this issue right away.

Just clamp the thing to a size that makes sense, add a "too long to be displayed entirely..." at the end and be done with it.
2009-04-15 09:35   
What about adding a text box to the message box
This would have the added advantage of copy and paste
I haven't actually looked at the code yet (SVN is being VERY slow atm)
2009-04-24 13:56   
You can't simply add a textbox as MessageBox is an actual MFC class.

I'll take a look at truncating the message though.
2009-04-25 02:04   
yeah - I wasn't sure if it was the windows message box or a custom one.
I've had a quick look through the code. There're a lot of message boxes that only have a short, but fixed message in them, and I'm sure there're a few which can have a (much!) longer message.
There're three ways I can think of of doing this:
1) Truncate the message - this may actually chop off important details, but I'm not sure
2) Define a LongMessageBox class (and dialog) and make the constructor similar to the call for MessageBox - I'm not sure if you can call DoModal in the constructor though
3) Define a LongMessageBox class globally and overload operator() - I know you can call DoModal there

The disadvantage is that we'd only be able to replace the MessageBox calls when someone reported the bug.

This is very similar to Karajormas first comment.

2009-04-25 10:29   
Well if you fancy coding that in, be my guest. I certainly think that 2 or 3 are the best choices, preferably 2.
2009-05-01 07:09   
hmm, found a bug in the call to campaign_tree_wnd::error - buf is char[2048] while the passed buf3 argument from campaign_tree_wnd::fred_check_sexp is char[4096] - could ruin someones day at some point - but maybe this hasn't yet been hit.

Can you give a case of how to cause this oversize messagebox?
Never having actually seen it, I'm not sure what I'm looking for.

I'll replace the overlength ones with a dialog that has a scrollable textbox in it - just need to figure out how to cause it/them!
2009-05-01 07:19   
Uploaded a file. All the instances of Ship 1 are merely to bulk out the size of the event, they don't actually do anything. The real problem is simply that I deleted the "Alpha 1" from the is-destroyed-delay SEXP.

2009-05-01 13:31   

This will be a fair bit harder than it looks :P
The function Warning (windebug.cpp) is called from all over the place, including in the game code, which doesn't have MFC initialised (and hence can't be used).
Changes here (the same changes need to be made to Error (windebug.cpp)) will affect the entire game.
I'm hesitant to use a define in stdafx.h for FRED because I don't know what it will stuff up.
2009-05-08 07:37   
I've attached a patch for this.
It simply trims off newlines after the 20th and adds a 'truncated' message.
Because the code for this is in the /code directory, and is shared between the engine, MFC can't be used because MFC hasn't been initialised. There is also no resources file to put dialog resources into (for that library).
The call to CFREDView::internal_error is forwarded to 'Error' so that the same benefit is extended to (some of) the FRED stuff.
There are wayyy too many error message handlers spread around the place.
2010-01-30 16:51   
Was this patch ever committed to trunk?
2010-07-27 23:00   
Doesn't appear to have been. Gonna see if anyone thinks it's gonna hurt something.
2012-06-25 02:47   
Derp... looks like this was a duplicate ticket. >.<

Oh well... my fix didn't use the same technique, but it has substantially the same effect. As a bonus, it fixes all handlers, not just the ones affected by portej05's patch.

Closing as duplicate.

Issue History
2008-09-27 08:27KeldorKatarnNew Issue
2009-04-01 17:39karajormaNote Added: 0010791
2009-04-01 18:08KeldorKatarnNote Added: 0010792
2009-04-11 07:30KeldorKatarnNote Added: 0010807
2009-04-15 09:35portej05Note Added: 0010809
2009-04-24 13:56karajormaNote Added: 0010841
2009-04-25 02:04portej05Note Added: 0010845
2009-04-25 02:04portej05Note Edited: 0010845
2009-04-25 10:29karajormaNote Added: 0010846
2009-05-01 07:09portej05Note Added: 0010863
2009-05-01 07:17karajormaFile Added: Borked.fs2
2009-05-01 07:19karajormaNote Added: 0010864
2009-05-01 07:19karajormaNote Edited: 0010864
2009-05-01 13:31portej05Note Added: 0010866
2009-05-08 07:30portej05File Added: Mantis1780diff.diff
2009-05-08 07:37portej05Note Added: 0010869
2010-01-30 16:51KeldorKatarnNote Added: 0011606
2010-07-27 23:00chief1983Note Added: 0012276
2012-06-25 02:44Goober5000Relationship addedduplicate of 0002658
2012-06-25 02:47Goober5000Note Added: 0013720
2012-06-25 02:47Goober5000Assigned To => Goober5000
2012-06-25 02:47Goober5000Statusnew => closed