See this examples:
Example 1 - manually Gadget coding:
Code: Select all
a$ = "Very very looooooong name + another loooooonnnnggggg term" ; for this long text-line a linebreak will automatically be done, if the TextGadget is small...
a$ + Chr(10) + "further text on a new line..." ; the Chr(10) will force a linebreak
If OpenWindow(0, 0, 0, 270, 160, "TextGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(0, 10, 10, 250, 70, a$)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Code: Select all
CompilerIf #PB_Compiler_Unicode
#XmlEncoding = #PB_UTF8
CompilerElse
#XmlEncoding = #PB_Ascii
CompilerEndIf
#Dialog = 0
#Xml = 0
a$ = "Very very looooooong name + another loooooonnnnggggg term"
a$ + Chr(10) + "further text on a new line..."
; If OpenWindow(0, 0, 0, 270, 160, "TextGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
; TextGadget(0, 10, 10, 250, 70, a$)
; Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
; EndIf
XML$ = "<window id='#PB_Any' name='test' text='test' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <vbox>" +
" <text text='" + a$ + "' />" +
" </vbox>" +
"</window>"
If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Else
Debug "Dialog error: " + DialogError(#Dialog)
EndIf
Else
Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIf