Differenze tra le versioni di "Mostrare un MessageBox con l'API di SDL2 in un programma 'a riga di comando'"

Da Gambas-it.org - Wikipedia.
(Creata pagina con "In un programma Gambas con nterfaccia a ''riga di comando'' (quindi non in ambiente grafico) è possibile far apparire e utilizzare un ''MessageBox'' bloccante mediante la fun...")
 
Riga 9: Riga 9:
 
  <FONT Color=gray>' ''int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)''
 
  <FONT Color=gray>' ''int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)''
 
  ' ''Create a simple modal message box.''</font>
 
  ' ''Create a simple modal message box.''</font>
  Private Extern SDL_ShowSimpleMessageBox(flags As Integer, title As String, message As String, SDL_Window As Pointer)
+
  Private Extern SDL_ShowSimpleMessageBox(flags As Integer, title As String, message As String, SDL_Window As Pointer) As Integer
 
   
 
   
 
   
 
   

Versione delle 17:27, 20 lug 2018

In un programma Gambas con nterfaccia a riga di comando (quindi non in ambiente grafico) è possibile far apparire e utilizzare un MessageBox bloccante mediante la funzione esterna "SDL_ShowSimpleMessageBox( )" del API di SDL2.

E' necessario avere installata nel sistema e richiamare nel programma Gambas la libreria dinamica condivisa: "libSDL2-2.0"


Mostriamo di seguito un semplice esempio pratico:

Library "libSDL2-2.0"

' int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
' Create a simple modal message box.
Private Extern SDL_ShowSimpleMessageBox(flags As Integer, title As String, message As String, SDL_Window As Pointer) As Integer


Public Sub Main()
 
 SDL_ShowSimpleMessageBox(0, "prova", "Questa è la prima riga del messaggio !\nQuesta è la seconda riga !", 0)
 
End

Va sottolineato che la finestra si adatterà automaticamente alla lunghezza del testo del messaggio.



Riferimenti