Msgbox using fbgfx

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Post Reply
marpon
Posts: 342
Joined: Dec 28, 2012 13:31
Location: Paris - France

Msgbox using fbgfx

Post by marpon »

Just an adaptation of the Dodicat code found here
viewtopic.php?f=3&t=17620&p=155292&hili ... fx#p155292

my idea was to have an equivalent msgbox even in linux able to work when using the normal console txt
to make a stop of process and show / select minimal information

i've only tested it under windows , what about linux?

some interresting point is the info is shown with some adaptative way to be as nice as possible
notice the ability to use the escape sequence on the string
the tabs have been simulated by 5 spaces

note: if fact in windows it not really needed , just use the normal messagebox ( putting the windows.bi is enougth)

Code: Select all

'fbgfx_msgbox.bas
'original code from Dodicat
'https://www.freebasic.net/forum/viewtopic.php?f=3&t=17620&p=155292&hilit=fake+fbgfx#p155292
' just adapted to create a stand alone class to make a msgbox

#include "fbgfx.bi"

#define _MAX_WIDTH_  50   ' maxi characters by line

Type box_t
   As Single x
	As Single y
	As Single z
   as string caption
   as ulong textcol
	as ulong boxcol
	as long iflag
End Type

type msg_box_t
	public:
		
		declare function msg_box(byref info2 as string = "", byref title as string = "", byval ibut as long = 1)as long			
		
	private:
		declare sub drawbox(byVal x as long, byVal y as long, box() as box_t, byVal boxlength as long, byVal boxheight as long, _
					byVal col as ulong, byVal highlight as ulong, byRef caption as string, byVal iorder as long = -1)
		declare Sub thickline(byVal x1 As Double, byVal y1 As Double, byVal x2 As Double, byVal y2 As Double, _
					byVal thickness As Double, byVal colour As Ulong, byVal im As Any Pointer = 0)
		declare Function inbox(p1() As box_t, byVal p2 As box_t) As long
		declare sub highlightbox(box() as box_t , byVal mp as box_t ,byVal col as ulong)
		declare Sub draw_box(p() As box_t , byVal col As Ulong , byRef pnt As String = "paint" , byVal im As Any Pointer = 0)
		declare function re_stack(byref stab as string, byref icount as long, byref y2 as long) as string
		
		as box_t button(4,1)			
		as long flag
		As fb.event e	
		
END TYPE

function msg_box_t.re_stack(byref stab as string, byref icount as long, byref y2 as long) as string
	dim as string dup = stab
	dim as ubyte ptr info = cast(ubyte ptr,strptr(dup))
	dim as long nb = len(stab)
	dim as long x2
	
	'print "len = ";nb
	nb -=1
	while nb > 0 and info[nb]
		'print "nb = ";nb;"  info[nb] = "; info[nb]; "  " ;chr(info[nb])
		if info[nb] = 32 then
			icount -= x2
			y2 -= x2
			info[nb] = 0
			'print *cast(zstring ptr, info)
			return *cast(zstring ptr, info)
      END IF
		x2 +=1
		nb -=1
	wend
	return stab
END FUNCTION

function msg_box_t.msg_box(byref info2 as string = "", byref title as string = "", byval ibut as long = 1)as long
	dim as string c
	dim as ulong background = rgb(235 , 235 , 235)
	dim tabl(0 to 14) as string
	dim as long nb
	dim x2 as long
	dim y2 as long
	dim isize as long
	dim as ubyte ptr info = cast(ubyte ptr,strptr(info2))
	dim stemp as string
	
	if ibut >2 THEN ibut = 2
	tabl(0)= ""
	y2 = 0
	flag = 0
	while info[x2] and nb < 15
		if info[x2] = 10 THEN
			nb +=1
			tabl(nb)= ""
			if y2 > isize THEN isize = y2
			y2 = 0
		elseif info[x2] <> 13 THEN
			y2 +=1
			if info[x2] = 9 and y2 < _MAX_WIDTH_ - 4 then
				y2 +=4
				tabl(nb) &= "     "
			elseif info[x2] = 9 then
				nb +=1
				tabl(nb) = "     "
				if y2 - 1 > isize THEN isize = y2 -1
				y2 = 5
			else
				if y2 > _MAX_WIDTH_ THEN
					stemp = tabl(nb)
					tabl(nb) = re_stack(stemp, x2, y2)
					if y2 > isize THEN isize = y2
					nb +=1
					y2 = 1
					tabl(nb) = chr(info[x2])
				Else
					tabl(nb) &= chr(info[x2])
				end if
			end if
		END IF
		x2 += 1
   WEND
	if y2 > isize THEN isize = y2
	isize *= 8
	x2 = (14 - nb)/2
	print "nb = ";nb,"x2 =";x2

	WindowTitle title
	Screen 16 , 32, 4, fb.GFX_WINDOWED Or fb.GFX_NO_SWITCH or fb.GFX_ALWAYS_ON_TOP
	Do
		screenlock
		Cls
		paint(0 , 0) , background
		for x1 as long = 0 to  nb
			draw string((512 - isize)/2  , 20 +(18 * (x2 + x1))) , tabl(x1)  , rgb(0 , 0 , 250)
      NEXT
		if ibut = 2 THEN
			drawbox(512/2 - 180  , 260 , button() , 150 , 50 , rgb(210 , 210 , 210) , rgb(0 , 150 , 255) , " OK", 1)
			drawbox(512/2 + 30 , 260 , button() , 150 , 50 , rgb(210 , 210 , 210) , rgb(0 , 150 , 255) , "Cancel", 2)
		else
			drawbox((512- 150) /2 , 260 , button() , 150 , 50 , rgb(210 , 210 , 210) , rgb(0 , 150 , 255) , " OK", 1)
      END IF
		screenunlock
		if flag then exit do
		if screenevent(@e) and e.type = 13 then exit do
		Sleep 1 , 1
		c = inkey

	Loop while c <> chr(27)
	'cls
	'screen 0   ' equivalent to fb_GfxScreen2( 0, 8, 0, 0, 0 )
	SCREEN 0,0,0,&h80000000   '  using flag : SCREEN_EXIT   to not erase the content of existing console information (if exists)
	return flag
END function

Sub msg_box_t.draw_box(p() As box_t , byVal col As Ulong , byRef pnt As String = "paint" , byVal im As Any Pointer = 0)
   Dim 			As Single n1 = p(4 , 0).z
   Dim         As long index
   Dim         As long nextindex
   Dim         As Double xc
   Dim         As Double yc
	
   For n As long = 1 To 4
      xc = xc + p(n , n1).x : yc = yc + p(n , n1).y
      index = n Mod 5 : nextindex = (n + 1) Mod 5
      If nextindex = 0 Then nextindex = 1
      thickline(p(index , n1).x , p(index , n1).y , p(nextindex , n1).x , p(nextindex , n1).y , 3 , col , im)
      'Line im,(p(index,n1).x,p(index,n1).y)-(p(nextindex,n1).x,p(nextindex,n1).y),col
   Next
   xc = xc / Ubound(p) : yc = yc / Ubound(p)
   If pnt = "paint" Then Paint(xc , yc) , col , col
End Sub

sub msg_box_t.highlightbox(box() as box_t, byVal mp as box_t, byVal col as ulong)
   box(4 , 0).z = 1
   if inbox(box() , mp) then draw_box(box() , col , "dont_paint")
end sub

Function msg_box_t.inbox(p1() As box_t, byVal p2 As box_t) As long
	type pt2d : as single x , y : end type
	type ln2d : as pt2d v1 , v2 : end type
	
	#macro isleft(L , p)
		- Sgn((L.v1.x - L.v2.x) *(p.y - L.v2.y) - (p.x - L.v2.x) *(L.v1.y - L.v2.y))
	#endmacro
	Dim As Single n1 = p1(4 , 0).z
	Dim         As long index
	Dim         As long nextindex
	Dim send    As ln2d
	Dim wn 		As long = 0
	
	For n As long = 1 To 4
		index = n Mod 5 : nextindex = (n + 1) Mod 5
		If nextindex = 0 Then nextindex = 1
		send.v1.x = p1(index , n1).x : send.v2.x = p1(nextindex , n1).x
		send.v1.y = p1(index , n1).y : send.v2.y = p1(nextindex , n1).y
		If p1(index , n1).y <= p2.y Then
			If p1(nextindex , n1).y > p2.y Then
				If isleft(send , p2) > 0 Then
					wn = wn + 1
				End If
			End If
		Else
			If p1(nextindex , n1).y <= p2.y Then
				If isleft(send , p2) < 0 Then
					wn = wn - 1
				End If
			End If
		End If
	Next n
	Return wn
End Function

sub msg_box_t.drawbox(byVal x as long , byVal y as long , box() as box_t , byVal boxlength as long , byVal boxheight as long , _
					byVal col as ulong , byVal highlight as ulong , byRef caption as string, byVal iorder as long = -1)
	Dim         As box_t startpoint
	dim         as box_t mouse
	dim         as long mmx
	dim         as long mmy
	
	startpoint.x = x 
	startpoint.y = y
	getmouse mmx , mmy
	mouse.x = mmx
	mouse.y = mmy
	box(4 , 1).boxcol = col
	box(4 , 1).caption = caption
	box(4 , 1).iflag = iorder
	dim as ulong outline , count = 1
	outline = rgb(255 , 255 , 255)
	For x As long = 1 To 4
		Select Case x
			Case 1
				box(1 , count).x = startpoint.x
				box(1 , count).y = startpoint.y
			Case 2
				box(2 , count).x = box(1 , count).x + boxlength
				box(2 , count).y = box(1 , count).y
			Case 3
				box(3 , count).x = box(2 , count).x
				box(3 , count).y = box(2 , count).y + boxheight
			Case 4
				box(4 , count).x = box(3 , count).x - boxlength
				box(4 , count).y = box(3 , count).y
		End Select
	Next x
	box(4 , 0).z = 1
	draw_box(box() , col)
	draw_box(box() , outline , "nopaint")
	if inbox(box() , mouse) then
		highlightbox(box() , mouse , highlight)
		If (ScreenEvent(@e)) and e.type = fb.EVENT_MOUSE_BUTTON_PRESS Then flag = box(4 , 1).iflag
	End If
	draw string(box(1 , 1).x + 55 , box(1 , 1).y + 18) , box(4 , 1).caption , box(4 , 1).textcol
end sub

Sub msg_box_t.thickline(byVal x1 As Double, byVal y1 As Double, byVal x2 As Double, byVal y2 As Double, _
					byVal thickness As Double, byVal colour As Ulong, byVal im As Any Pointer = 0)
	Dim p As Ulong = Rgb(255 , 255 , 254)
	If thickness < 2 Then
		Line(x1 , y1) - (x2 , y2) , colour
	Else
		dim as double h = Sqr((x2 - x1) ^ 2 + (y2 - y1) ^ 2) 
		dim as double s = (y1 - y2) / h 
		dim as double c = (x2 - x1) / h
		for x as long = 1 to 2
			Line im ,(x1 + s * thickness / 2 , y1 + c * thickness / 2) - (x2 + s * thickness / 2 , y2 + c * thickness / 2) , p
			Line im ,(x1 - s * thickness / 2 , y1 - c * thickness / 2) - (x2 - s * thickness / 2 , y2 - c * thickness / 2) , p
			Line im ,(x1 + s * thickness / 2 , y1 + c * thickness / 2) - (x1 - s * thickness / 2 , y1 - c * thickness / 2) , p
			Line im ,(x2 + s * thickness / 2 , y2 + c * thickness / 2) - (x2 - s * thickness / 2 , y2 - c * thickness / 2) , p
			Paint im ,((x1 + x2) / 2 ,(y1 + y2) / 2) , p , p
			p = colour
		next x
	End If
End Sub




'****************************************************************************************************************
'		Main proc
'****************************************************************************************************************

dim as msg_box_t box_cl


dim as string toto = "test" & chr(10)& "Message to show very very long one to test the splitting feature" & chr(10) & !"coucou\x0A"  _
& chr(10) & !"abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz\x0A0123456789"

print toto
 print box_cl.msg_box(toto , "Title of window" , 2  )
sleep 1000

print " added coucou"

print box_cl.msg_box(toto & chr(10,10,9) & !"added\x09coucou", "Title of window :  added coucou", 1  )
print : print "this prog will terminate after 10 seconds, or press a key to close it"
sleep 10000


'		End Main proc
'****************************************************************************************************************
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Msgbox using fbgfx

Post by srvaldez »

marpon wrote: i've only tested it under windows , what about linux?
works OK on my Mac, I know MacOS is not linux, it's based on BSD but my guess is that it will work on linux as well.
thanks for sharing :-)
David Watson
Posts: 57
Joined: May 15, 2013 16:48
Location: England

Re: Msgbox using fbgfx

Post by David Watson »

Worked fine on my linux system.
mrminecrafttnt
Posts: 131
Joined: Feb 11, 2013 12:23

Re: Msgbox using fbgfx

Post by mrminecrafttnt »

Bug: It crashes when the String is empty..
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: Msgbox using fbgfx

Post by sancho3 »

This is an ideal situation in which to use a static function for msg_box.
There is no need to create multiple instances of the message box class.

As mrminecrafttnt points out, it puts up a Null Pointer Access error (on line 79) because when there is nothing at info[0].
strptr in the dim line is returning 0 'cast(ubyte ptr,strptr(s))'
You could enclose the while loop there in an if statement:

Code: Select all

   if len(info2)>0 then
marpon
Posts: 342
Joined: Dec 28, 2012 13:31
Location: Paris - France

Re: Msgbox using fbgfx

Post by marpon »

corrected version, thanks for the comments

@to sancho3
checking the pointer, better than testing the length, (it is what you want to trap really , if the strptr is returning 0)
This is an ideal situation in which to use a static function for msg_box.
There is no need to create multiple instances of the message box class.
true , but in fact is more difficult to work with static functions they need also static members...
for nothing in fact, you instanciate the class when/where you need it, the defaut destructor will kill every thing for you depending of the scope.


in fact i've done that code because i was wondering how to play where not in windows OS( because it have its own messagebox)
if you have an executable working silently without console nor graphic window , if something needs to be showed to user until he validates to continue or abort how to do it simply?

now i have a solution

Code: Select all

'fbgfx_msgbox.bas
'original code from Dodicat
'https://www.freebasic.net/forum/viewtopic.php?f=3&t=17620&p=155292&hilit=fake+fbgfx#p155292
' just adapted to create a stand alone class to make a msgbox

#include "fbgfx.bi"

#define _MAX_WIDTH_  50   ' maxi characters by line

Type box_t
   As Single x
	As Single y
	As Single z
   as string caption
   as ulong textcol
	as ulong boxcol
	as long iflag
End Type

type msg_box_t
	public:
		
		declare function msg_box(byref info2 as string = "", byref title as string = "", byval ibut as long = 1)as long			
		
	private:
		declare sub drawbox(byVal x as long, byVal y as long, box() as box_t, byVal boxlength as long, byVal boxheight as long, _
					byVal col as ulong, byVal highlight as ulong, byRef caption as string, byVal iorder as long = -1)
		declare Sub thickline(byVal x1 As Double, byVal y1 As Double, byVal x2 As Double, byVal y2 As Double, _
					byVal thickness As Double, byVal colour As Ulong, byVal im As Any Pointer = 0)
		declare Function inbox(p1() As box_t, byVal p2 As box_t) As long
		declare sub highlightbox(box() as box_t , byVal mp as box_t ,byVal col as ulong)
		declare Sub draw_box(p() As box_t , byVal col As Ulong , byRef pnt As String = "paint" , byVal im As Any Pointer = 0)
		declare function re_stack(byref stab as string, byref icount as long, byref y2 as long) as string
		
		as box_t button(4,1)			
		as long flag
		As fb.event e	

		
END TYPE

function msg_box_t.re_stack(byref stab as string, byref icount as long, byref y2 as long) as string
	dim as string dup = stab
	dim as ubyte ptr info = cast(ubyte ptr,strptr(dup))
	dim as long nb = len(stab)
	dim as long x2
	
	nb -=1
	while nb > 0 and info[nb]
		if info[nb] = 32 then
			icount -= x2
			y2 -= x2
			info[nb] = 0
			return *cast(zstring ptr, info)
      END IF
		x2 +=1
		nb -=1
	wend
	return stab
END FUNCTION

function msg_box_t.msg_box(byref info2 as string = "", byref title as string = "", byval ibut as long = 1)as long
	dim as string c
	dim as ulong background = rgb(235 , 235 , 235)
	dim tabl(0 to 14) as string
	dim as long nb
	dim x2 as long
	dim y2 as long
	dim isize as long
	dim as ubyte ptr info = cast(ubyte ptr,strptr(info2))
	dim stemp as string
	
	flag = 0
	if ibut >2 THEN ibut = 2
	if info > 0 THEN
		while info[x2] and nb < 15
			if info[x2] = 10 THEN
				nb +=1
				if y2 > isize THEN isize = y2
				y2 = 0
			elseif info[x2] <> 13 THEN  'trap  windows cr 
				y2 +=1
				if info[x2] = 9 and y2 < _MAX_WIDTH_ - 4 then
					y2 +=4
					tabl(nb) &= "     "
				elseif info[x2] = 9 then
					nb +=1
					tabl(nb) = "     "
					if y2 - 1 > isize THEN isize = y2 -1
					y2 = 5
				else
					if y2 > _MAX_WIDTH_ THEN
						stemp = tabl(nb)
						tabl(nb) = re_stack(stemp, x2, y2)
						if y2 > isize THEN isize = y2
						nb +=1
						y2 = 1
					end if
					tabl(nb) &= chr(info[x2])
				end if
			END IF
			x2 += 1
		WEND
	END IF
	if y2 > isize THEN isize = y2
	isize *= 8
	x2 = (14 - nb)/2
	WindowTitle title
	Screen 16 , 32, 4, fb.GFX_WINDOWED Or fb.GFX_NO_SWITCH or fb.GFX_ALWAYS_ON_TOP
	Do
		screenlock
		Cls
		paint(0 , 0) , background
		for x1 as long = 0 to  nb
			draw string((512 - isize)/2  , 20 +(18 * (x2 + x1))) , tabl(x1)  , rgb(0 , 0 , 250)
      NEXT
		if ibut = 2 THEN
			drawbox(512/2 - 180  , 260 , button() , 150 , 50 , rgb(210 , 210 , 210) , rgb(0 , 150 , 255) , " OK", 1)
			drawbox(512/2 + 30 , 260 , button() , 150 , 50 , rgb(210 , 210 , 210) , rgb(0 , 150 , 255) , "Cancel", 2)
		else
			drawbox((512- 150) /2 , 260 , button() , 150 , 50 , rgb(210 , 210 , 210) , rgb(0 , 150 , 255) , " OK", 1)
      END IF
		screenunlock
		if flag then exit do
		if screenevent(@e) and e.type = 13 then exit do
		Sleep 1 , 1
		c = inkey

	Loop while c <> chr(27)
	'cls
	'screen 0   ' equivalent to fb_GfxScreen2( 0, 8, 0, 0, 0 )
	SCREEN 0, 0, 0, &h80000000   '  using flag : SCREEN_EXIT   to not erase the content of existing console information (if exists)
	return flag
END function

Sub msg_box_t.draw_box(p() As box_t , byVal col As Ulong , byRef pnt As String = "paint" , byVal im As Any Pointer = 0)
   Dim 			As Single n1 = p(4 , 0).z
   Dim         As long index
   Dim         As long nextindex
   Dim         As Double xc
   Dim         As Double yc
	
   For n As long = 1 To 4
      xc = xc + p(n , n1).x : yc = yc + p(n , n1).y
      index = n Mod 5 : nextindex = (n + 1) Mod 5
      If nextindex = 0 Then nextindex = 1
      thickline(p(index , n1).x , p(index , n1).y , p(nextindex , n1).x , p(nextindex , n1).y , 3 , col , im)
      'Line im,(p(index,n1).x,p(index,n1).y)-(p(nextindex,n1).x,p(nextindex,n1).y),col
   Next
   xc = xc / Ubound(p) : yc = yc / Ubound(p)
   If pnt = "paint" Then Paint(xc , yc) , col , col
End Sub

sub msg_box_t.highlightbox(box() as box_t, byVal mp as box_t, byVal col as ulong)
   box(4 , 0).z = 1
   if inbox(box() , mp) then draw_box(box() , col , "dont_paint")
end sub

Function msg_box_t.inbox(p1() As box_t, byVal p2 As box_t) As long
	type pt2d : as single x , y : end type
	type ln2d : as pt2d v1 , v2 : end type
	
	#macro isleft(L , p)
		- Sgn((L.v1.x - L.v2.x) *(p.y - L.v2.y) - (p.x - L.v2.x) *(L.v1.y - L.v2.y))
	#endmacro
	Dim As Single n1 = p1(4 , 0).z
	Dim         As long index
	Dim         As long nextindex
	Dim send    As ln2d
	Dim wn 		As long = 0
	
	For n As long = 1 To 4
		index = n Mod 5 : nextindex = (n + 1) Mod 5
		If nextindex = 0 Then nextindex = 1
		send.v1.x = p1(index , n1).x : send.v2.x = p1(nextindex , n1).x
		send.v1.y = p1(index , n1).y : send.v2.y = p1(nextindex , n1).y
		If p1(index , n1).y <= p2.y Then
			If p1(nextindex , n1).y > p2.y Then
				If isleft(send , p2) > 0 Then
					wn = wn + 1
				End If
			End If
		Else
			If p1(nextindex , n1).y <= p2.y Then
				If isleft(send , p2) < 0 Then
					wn = wn - 1
				End If
			End If
		End If
	Next n
	Return wn
End Function

sub msg_box_t.drawbox(byVal x as long , byVal y as long , box() as box_t , byVal boxlength as long , byVal boxheight as long , _
					byVal col as ulong , byVal highlight as ulong , byRef caption as string, byVal iorder as long = -1)
	Dim         As box_t startpoint
	dim         as box_t mouse
	dim         as long mmx
	dim         as long mmy
	
	startpoint.x = x 
	startpoint.y = y
	getmouse mmx , mmy
	mouse.x = mmx
	mouse.y = mmy
	box(4 , 1).boxcol = col
	box(4 , 1).caption = caption
	box(4 , 1).iflag = iorder
	dim as ulong outline , count = 1
	outline = rgb(255 , 255 , 255)
	For x As long = 1 To 4
		Select Case x
			Case 1
				box(1 , count).x = startpoint.x
				box(1 , count).y = startpoint.y
			Case 2
				box(2 , count).x = box(1 , count).x + boxlength
				box(2 , count).y = box(1 , count).y
			Case 3
				box(3 , count).x = box(2 , count).x
				box(3 , count).y = box(2 , count).y + boxheight
			Case 4
				box(4 , count).x = box(3 , count).x - boxlength
				box(4 , count).y = box(3 , count).y
		End Select
	Next x
	box(4 , 0).z = 1
	draw_box(box() , col)
	draw_box(box() , outline , "nopaint")
	if inbox(box() , mouse) then
		highlightbox(box() , mouse , highlight)
		If (ScreenEvent(@e)) and e.type = fb.EVENT_MOUSE_BUTTON_PRESS Then flag = box(4 , 1).iflag
	End If
	draw string(box(1 , 1).x + 55 , box(1 , 1).y + 18) , box(4 , 1).caption , box(4 , 1).textcol
end sub

Sub msg_box_t.thickline(byVal x1 As Double, byVal y1 As Double, byVal x2 As Double, byVal y2 As Double, _
					byVal thickness As Double, byVal colour As Ulong, byVal im As Any Pointer = 0)
	Dim p As Ulong = Rgb(255 , 255 , 254)
	If thickness < 2 Then
		Line(x1 , y1) - (x2 , y2) , colour
	Else
		dim as double h = Sqr((x2 - x1) ^ 2 + (y2 - y1) ^ 2) 
		dim as double s = (y1 - y2) / h 
		dim as double c = (x2 - x1) / h
		for x as long = 1 to 2
			Line im ,(x1 + s * thickness / 2 , y1 + c * thickness / 2) - (x2 + s * thickness / 2 , y2 + c * thickness / 2) , p
			Line im ,(x1 - s * thickness / 2 , y1 - c * thickness / 2) - (x2 - s * thickness / 2 , y2 - c * thickness / 2) , p
			Line im ,(x1 + s * thickness / 2 , y1 + c * thickness / 2) - (x1 - s * thickness / 2 , y1 - c * thickness / 2) , p
			Line im ,(x2 + s * thickness / 2 , y2 + c * thickness / 2) - (x2 - s * thickness / 2 , y2 - c * thickness / 2) , p
			Paint im ,((x1 + x2) / 2 ,(y1 + y2) / 2) , p , p
			p = colour
		next x
	End If
End Sub




'****************************************************************************************************************
'		Main proc
'****************************************************************************************************************

dim as msg_box_t box_cl


dim as string toto = "test" & chr(10)& "Message to show very very long one to test the splitting feature" & chr(10) & !"coucou\x0A"  _
& chr(10) & !"abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz\x0A0123456789"

print toto
print box_cl.msg_box(toto , "Title of window" , 2  )
sleep 1000

print " added coucou" : print
print toto
print box_cl.msg_box(toto & chr(10,10,9) & !"added\x09coucou", "Title of window :  added coucou", 1  )
sleep 1000
print "tried empty"
print box_cl.msg_box()
print : print "this prog will terminate after 10 seconds, or press a key to close it"
sleep 10000


'		End Main proc
'****************************************************************************************************************
Post Reply