Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Message Boxes  (Read 24770 times)

0 Members and 1 Guest are viewing this topic.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Message Boxes
« Reply #15 on: July 24, 2009, 09:28:50 pm »
Quote from: "Laurent"
Quote
It should display a message box or something similar... and these aren't compatible with streams.

Why not? You can redirect the stream to whatever you want, even message boxes.
The good thing with standard streams is that they don't care about where they write, they just send their content to their streambuf, which can be specialized to write to anything that support text output.


Technically it might be possible. But semantically it would probably turn out to be nonsense. When do you display the message box? When a newline occurs? What about multiline messages? Also, when is the stream flushed (and the message box actually displayed) etc.

EDIT:
And this would still require a platform-dependent message box ;-)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Message Boxes
« Reply #16 on: July 24, 2009, 11:08:57 pm »
Quote
Technically it might be possible. But semantically it would probably turn out to be nonsense. When do you display the message box? When a newline occurs? What about multiline messages? Also, when is the stream flushed (and the message box actually displayed) etc.

The stream is flushed and the message box displayed, when... well, the stream is flushed ;)
I mean std::cerr << std::flush (which is also called by std::cerr << std::endl). A multiline message can then be displayed using '\n'.

Quote
EDIT:
And this would still require a platform-dependent message box

But then it's not mandatory to be implemented in SFML ;)
Laurent Gomila - SFML developer

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Message Boxes
« Reply #17 on: July 24, 2009, 11:33:24 pm »
Quote from: "Laurent"
Quote
Technically it might be possible. But semantically it would probably turn out to be nonsense. When do you display the message box? When a newline occurs? What about multiline messages? Also, when is the stream flushed (and the message box actually displayed) etc.

The stream is flushed and the message box displayed, when... well, the stream is flushed ;)
I mean std::cerr << std::flush (which is also called by std::cerr << std::endl). A multiline message can then be displayed using '\n'.


not exactly. streams can be flushed at any time, not only when flush or endl are used!

Quote

Quote
EDIT:
And this would still require a platform-dependent message box

But then it's not mandatory to be implemented in SFML ;)


but still very useful ;-)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Message Boxes
« Reply #18 on: July 24, 2009, 11:52:34 pm »
Quote
not exactly. streams can be flushed at any time, not only when flush or endl are used!

How (or when)?

Quote
but still very useful

Still out of scope, in my opinion ;)
Laurent Gomila - SFML developer

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Message Boxes
« Reply #19 on: July 25, 2009, 12:41:17 am »
Quote from: "Laurent"
Quote
not exactly. streams can be flushed at any time, not only when flush or endl are used!

How (or when)?
When the buffer is full. (?)
But std::cerr has no buffer so std::cerr << std::flush does nothing.
SFML / OS X developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Message Boxes
« Reply #20 on: July 25, 2009, 11:02:08 am »
Quote
But std::cerr has no buffer so std::cerr << std::flush does nothing.

What do you mean?
Laurent Gomila - SFML developer

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Message Boxes
« Reply #21 on: July 27, 2009, 11:02:43 am »
Quote from: "Hiura"
Quote from: "Laurent"
Quote
not exactly. streams can be flushed at any time, not only when flush or endl are used!

How (or when)?
When the buffer is full. (?)

Yes.

Quote

But std::cerr has no buffer so std::cerr << std::flush does nothing.

Not quite sure what you mean either

Ankou

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Message Boxes
« Reply #22 on: July 29, 2009, 05:41:55 pm »
I would like to see this too.
The only way to have such a thing would be to use an additional GUI library but this is way to heavyweight just for showing an error.
Showing errors in errordialog is at least on windows standard and not inconvenient on other plattforms so I think it really is the best way to inform the user that an error occured.
You could make an errorfunction in the Systemlib or wherever which shows an messagebox, logs the error and so on, I think this would fit sfml much better then adding a messagebox class since a general messagebox would be a gui element..

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Message Boxes
« Reply #23 on: August 02, 2009, 12:47:34 pm »
One week later...  :roll:

Quote from: "Laurent"
Quote
But std::cerr has no buffer so std::cerr << std::flush does nothing.

What do you mean?
I mean this : http://www.dinkumware.com/manuals/?manual=compleat&page=iostream.html#cerr
Quote
The object controls unbuffered insertions to the standard error output
SFML / OS X developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Message Boxes
« Reply #24 on: August 02, 2009, 01:36:21 pm »
Ok, but it doesn't matter as I'm planning to use my own ostream instance for SFML instead of std::cerr ;)
Laurent Gomila - SFML developer

 

anything