Page 1 of 1
Dialog feature multi language?
Posted: Tue Nov 05, 2013 8:39 am
by Kukulkan
Hi,
I create a dialog using some XML (binary included). It contains elements like this:
Code: Select all
<text name='txtUser' colspan='2' text='Username:'/>
Later, I update the text using code like this (content depending on chosen language):
Code: Select all
SetGadgetText(DialogGadget(iDialog, "txtUser"), "Please enter user name:")
The problem is, that the dialog is scaled to fit to "Username:" and the new text "Please enter user name:" is to big and runs out of the window. But, especially for translations, the width of the text heavily changes (eg French is always a little longer). My dialogs are now to small.
I believe, one of the benefits of such dialog layout engine is to prevent this. Is there some
recalculate boundaries or
re-scale function available that uses the adapted text sizes to get the correct minimum sizes? Sadly I can not call SetGadgetText() before calling OpenXMLDialog()...
Kukulkan
Re: Dialog feature multi language?
Posted: Tue Nov 05, 2013 8:51 am
by Fred
True, multi language support is planned for dialog. In the meantime, you could try to use ResizeWindow(), it should trigger the layout recalc.
Re: Dialog feature multi language?
Posted: Tue Nov 05, 2013 9:11 am
by Kukulkan
Hi Fred, thank you for the quick info. So I should better wait utilizing the Dialog feature for now?
This does not work. What am I'm doing wrong?
Code: Select all
ResizeWindow(DialogWindow(iDialog), #PB_Ignore, #PB_Ignore, #PB_Ignore, #PB_Ignore)
Kukulkan
Re: Dialog feature multi language?
Posted: Tue Nov 05, 2013 10:39 am
by Fred
If you set ignore on all fields, it does nothing

. Try to simulate a resize like that:
Code: Select all
ResizeWindow(DialogWindow(iDialog), #PB_Ignore, #PB_Ignore, WindowWidth(DialogWindow(iDialog))+1, #PB_Ignore)
ResizeWindow(DialogWindow(iDialog), #PB_Ignore, #PB_Ignore, WindowWidth(DialogWindow(iDialog))-1, #PB_Ignore)
You can create the dialog as invisible and show it after the reisze.
Re: Dialog feature multi language?
Posted: Tue Nov 05, 2013 11:07 am
by Kukulkan
Sorry Fred, it stays the same size here. It still does not resize to fit the text. Example:
Code: Select all
CompilerIf #PB_Compiler_Unicode
#XmlEncoding = #PB_UTF8
CompilerElse
#XmlEncoding = #PB_Ascii
CompilerEndIf
#Dialog = 0
#Xml = 0
XML$ = "<window id='#PB_Any' name='test' text='Gridbox' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <gridbox columns='1'>" +
" <option name='opt1' text='Option 1 is short' />" +
" <option name='opt2' text='Option 2' />" +
" </gridbox>" +
" </window>"
If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
SetGadgetText(DialogGadget(#Dialog, "opt1"), "This is some longer text for option 1")
; resize to fit again
ResizeWindow(DialogWindow(#Dialog), #PB_Ignore, #PB_Ignore, WindowWidth(DialogWindow(#Dialog))+1, #PB_Ignore)
ResizeWindow(DialogWindow(#Dialog), #PB_Ignore, #PB_Ignore, WindowWidth(DialogWindow(#Dialog))-1, #PB_Ignore)
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
Kukulkan
Re: Dialog feature multi language?
Posted: Wed Nov 06, 2013 1:07 pm
by Kukulkan
Sorry for bothering you, but what is my error? Or is this still not possible?
Kukulkan
Re: Dialog feature multi language?
Posted: Wed Nov 06, 2013 1:12 pm
by Fred
Yes, it doesn't seem possible for now.