msgbox
msgbox
How do I setup a msgbox or message box in freebasic?
I got this from a visual basic example but it compiled with an error. (Array not dimensioned)
#include "windows.bi"
dim answer
answer=MsgBox("Hello everyone!",65,"Example")
document.write(answer)
I got this from a visual basic example but it compiled with an error. (Array not dimensioned)
#include "windows.bi"
dim answer
answer=MsgBox("Hello everyone!",65,"Example")
document.write(answer)
-
- Posts: 84
- Joined: Feb 03, 2007 2:37
Code: Select all
#Include "windows.bi"
MessageBox NULL, "Hello Everyone", "Example", MB_ICONASTERISK
message box
Thanks, It worked. Now I also need to identify the IDOK and IDCANCEL as in
MessageBox NULL, "Hello Everyone This is a test", "Example", MB_OKCANCEL
if IDOK=1 then beep
end
What am I doing wrong?
MessageBox NULL, "Hello Everyone This is a test", "Example", MB_OKCANCEL
if IDOK=1 then beep
end
What am I doing wrong?
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Code: Select all
#include "windows.bi"
dim as integer answer
answer=MessageBox( NULL, "Hello Everyone This is a test", "Example", MB_OKCANCEL )
' 1=first button but you can use the right constant for it
if answer=1 then
print "ok ..."
' 2=second button but you can use the right constant for it
elseif answer=2 then
print "cancel ..."
else
print "ups what you are doing?"
end if
sleep
msgbox
Thanks to everyone. You all were very helpful and everything works!
-
- Posts: 1706
- Joined: May 27, 2005 6:34
- Location: Cambodia, Thailand, Lao, Ireland etc.
- Contact:
This is a gtk example on Linux...Landeel wrote:Very nice. But is there such a simple way to do the same on Linux???
Garvan
Code: Select all
#include once "gtk/gtk.bi"
#define NULL 0
dim as GtkWidget ptr dialog
dim as integer answer
gtk_init(NULL, NULL)
dialog = gtk_message_dialog_new(NULL, _
GTK_DIALOG_DESTROY_WITH_PARENT, _
GTK_MESSAGE_QUESTION, _
GTK_BUTTONS_OK_CANCEL, _
"Hello Everyone This is a test")
answer = gtk_dialog_run(GTK_DIALOG(dialog))
If answer=GTK_RESPONSE_OK Then
Print "ok ..."
Elseif answer=GTK_RESPONSE_CANCEL Then
Print "cancel ..."
Else
Print "ups what you are doing?"
End If
gtk_widget_destroy(dialog)
It is kind of a problem with being cross platform, on linux using GTK is not such a good idea, for its another dependency, even if it was done in X, you have the fact that fb linux allows you to use framebuffer or whatever it is, where you don't need X, plus in DOS you have the problem, it could be done in a graphical mode, but what about text mode?
I'm sure there are ways to do it to satisfy all the different combinations, but i can imagine it being being a bit of a hacky maintenance nightmare.
I'm sure there are ways to do it to satisfy all the different combinations, but i can imagine it being being a bit of a hacky maintenance nightmare.
This code is fantastic Thank you the best solutionSisophon2001 wrote:This is a gtk example on Linux...Landeel wrote:Very nice. But is there such a simple way to do the same on Linux???
Garvan
Code: Select all
#include once "gtk/gtk.bi" #define NULL 0 dim as GtkWidget ptr dialog dim as integer answer gtk_init(NULL, NULL) dialog = gtk_message_dialog_new(NULL, _ GTK_DIALOG_DESTROY_WITH_PARENT, _ GTK_MESSAGE_QUESTION, _ GTK_BUTTONS_OK_CANCEL, _ "Hello Everyone This is a test") answer = gtk_dialog_run(GTK_DIALOG(dialog)) If answer=GTK_RESPONSE_OK Then Print "ok ..." Elseif answer=GTK_RESPONSE_CANCEL Then Print "cancel ..." Else Print "ups what you are doing?" End If gtk_widget_destroy(dialog)
Please, where could I get the syntax and parameters for the MessageBox command ?
I know: MessageBox xxx, "Text msg", "window title", MB_value
- is xxx always 'NULL', and what means it ?
- In Text msg, I have tried with success CHR(13)+CHR(10) for line feed, and CHR(9) for tab, is there something else ?
- MB_value defines the icon before 'Text msg' and the kind and number of buttons to click. e.g. ICONASTERISK, OK or OKONLY, ICONERROR, OKCANCEL, ABORTRETRYIGNORE, YESNO, YESNOCANCEL, RETRYCANCEL, etc.
- How to get the button clicked in FreeBasic, if more than one ?
I know: MessageBox xxx, "Text msg", "window title", MB_value
- is xxx always 'NULL', and what means it ?
- In Text msg, I have tried with success CHR(13)+CHR(10) for line feed, and CHR(9) for tab, is there something else ?
- MB_value defines the icon before 'Text msg' and the kind and number of buttons to click. e.g. ICONASTERISK, OK or OKONLY, ICONERROR, OKCANCEL, ABORTRETRYIGNORE, YESNO, YESNOCANCEL, RETRYCANCEL, etc.
- How to get the button clicked in FreeBasic, if more than one ?