Discussion:
Msgbox window background color
donJ
2017-07-23 17:23:53 UTC
Permalink
Hi,

Short of re-inventing the entire wheel, is there a way to put a
background color in a messege box window? This is for a game and so
doesn't really need to match the user's theme.


Don



To unsubscribe, email ***@xojo.com
TJ Hanson PhD
2017-07-23 17:28:39 UTC
Permalink
I use the Round Rectangle control to put a background color on my pushbuttons. I rather doubt if you could do this with a MsgBox since you don’t have control of it. But you can experiment with the round rectangle and maybe come up with something. Like displaying a round rectangle with a label inside; and forget the msgbox.

TJ
Hi,
Short of re-inventing the entire wheel, is there a way to put a background color in a messege box window? This is for a game and so doesn't really need to match the user's theme.
Don
To unsubscribe, email ***@xojo.com
donJ
2017-07-23 21:12:09 UTC
Permalink
Post by TJ Hanson PhD
I use the Round Rectangle control to put a background color on my pushbuttons. I rather doubt if you could do this with a MsgBox since you don’t have control of it. But you can experiment with the round rectangle and maybe come up with something. Like displaying a round rectangle with a label inside; and forget the msgbox.
TJ
Hi,
Short of re-inventing the entire wheel, is there a way to put a background color in a messege box window? This is for a game and so doesn't really need to match the user's theme.
Don
Thanks TJ and Jon. The rectangle idea might work. I'll experiment a little.



To unsubscribe, email ***@xojo.com
Jon Ogden
2017-07-23 19:44:45 UTC
Permalink
You might be able to do something more with MessageDialog. Not sure though.

Sent from my iPhone
Hi,
Short of re-inventing the entire wheel, is there a way to put a background color in a messege box window? This is for a game and so doesn't really need to match the user's theme.
Don
To unsubscribe, email ***@xojo.com
Marnaud
2017-07-23 19:48:23 UTC
Permalink
Post by Jon Ogden
You might be able to do something more with MessageDialog. Not sure though.
Since you can’t obtain it’s handle, I don’t think you can do much. Creating a custom one is trivial, however.


To unsubscribe, email ***@xojo.com
donJ
2017-07-23 21:14:42 UTC
Permalink
Post by Marnaud
Post by Jon Ogden
You might be able to do something more with MessageDialog. Not sure though.
Since you can’t obtain it’s handle, I don’t think you can do much. Creating a custom one is trivial, however.
Is it trivial?


The msgbox() returns a value indicating which buttonwas pressed. How can
I do something like:

i = MyWindow.ShowModal

??

I suppose I could set a property on the window that called it.

Thank you for the idea.

Don



To unsubscribe, email ***@xojo.com
Jon Ogden
2017-07-23 22:22:41 UTC
Permalink
It’s quite simple. Create a window that acts as your pop up. Call it MyMsgBox or whatever. Make sure it is not intrinsic.

Now add a function to the window called RunDialog. Add a property to the Window called RetVal and set it to type integer or whatever you want. Here is example code for the method

Public Function RunDialog(TheMessage as String) as Integer

TextField1.Text = TheMessage
Self.ShowModal
Return RetVal

End Sub


So Textfield1 is on your window. RetVal is set by whatever button is pressed to close the window. You set things up like this:

Dim w as New MyMsgBox
Dim MyVal as Integer = w.RunDialog(“This is some Text.”)

It’s that simple. Now you can make the window look however you want.



Sent from my iPhone
Post by donJ
Post by Marnaud
Post by Jon Ogden
You might be able to do something more with MessageDialog. Not sure though.
Since you can’t obtain it’s handle, I don’t think you can do much. Creating a custom one is trivial, however.
Is it trivial?
i = MyWindow.ShowModal
??
I suppose I could set a property on the window that called it.
Thank you for the idea.
Don
To unsubscribe, email ***@xojo.com
donJ
2017-07-23 23:15:04 UTC
Permalink
Post by Jon Ogden
It’s quite simple. Create a window that acts as your pop up. Call it MyMsgBox or whatever. Make sure it is not intrinsic.
Now add a function to the window called RunDialog. Add a property to the Window called RetVal and set it to type integer or whatever you want. Here is example code for the method
Public Function RunDialog(TheMessage as String) as Integer
TextField1.Text = TheMessage
Self.ShowModal
Return RetVal
End Sub
Dim w as New MyMsgBox
Dim MyVal as Integer = w.RunDialog(“This is some Text.”)
It’s that simple. Now you can make the window look however you want.
Sent from my iPhone
Hi Jon,
Thank you for your time. I'm going to have to study this for a bit, but
it looks like just what I need.
Don


To unsubscribe, email ***@xojo.com
donJ
2017-07-23 23:27:05 UTC
Permalink
Post by Jon Ogden
Dim w as New MyMsgBox
Dim MyVal as Integer = w.RunDialog(“This is some Text.”)
I just tried it. It works perfectly. And so simple when someone explains
it to you :-)


Thanks,

Don



To unsubscribe, email ***@xojo.com
Jon Ogden
2017-07-24 00:17:19 UTC
Permalink
Thank Norman Palardy as he’s the one who taught it to me!

Sent from my iPhone
Post by Jon Ogden
Dim w as New MyMsgBox
Dim MyVal as Integer = w.RunDialog(“This is some Text.”)
I just tried it. It works perfectly. And so simple when someone explains it to you :-)
Thanks,
Don
To unsubscribe, email ***@xojo.com

Continue reading on narkive:
Loading...