Linux Lib: a messagerequester replacement using GTK

Developed or developing a new product in PureBasic? Tell the world about it.
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Linux Lib: a messagerequester replacement using GTK

Post by walker »

Maybe not a real replacement but a good additional command (imo)
and a small demo to use with TailBite...
Simple usage:

Code: Select all

MsgBox("My message text",#GTK_MESSAGE_ERROR,#GTK_BUTTONS_OK,"","")
as type you can use:

Code: Select all

#GTK_MESSAGE_ERROR
#GTK_MESSAGE_INFO
#GTK_MESSAGE_QUESTION
#GTK_MESSAGE_WARNING
as buttons you can use

Code: Select all

#GTK_BUTTONS_OK
#GTK_BUTTONS_CLOSE
#GTK_BUTTONS_OK_CANCEL
#GTK_BUTTONS_YES_NO
#GTK_BUTTONS_NONE
#GTK_BUTTONS_CANCEL
the two last parameters can be used to substitute a variable within the Messagetext. The variable to be substituted is %s (the first occurance of %s will be replaced by the first text, the second one by the second text)

example:

Code: Select all

MsgBox("My %s message text %s",#GTK_MESSAGE_ERROR,#GTK_BUTTONS_OK,"first","is not long")
the link to the lib:
http://home.arcor.de/x-linux/pure/msgbox/msg_box_lib

and the source:
http://home.arcor.de/x-linux/pure/msgbox/msg_box_lib.pb

A warning: if you use this command before one window was opened you must use gtk_init_(0,0) befor you can use this command otherwise the gtk_init_() stuff will be done automatically when opening a window

A thing you can't change is the titel of the Message (this is determined by the message type) BUT you'll have the little image like on Windows and the variable substitution 8)

As always... comments, suggestions are apreciated..