Dialog feature multi language?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Dialog feature multi language?

Post 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
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Dialog feature multi language?

Post 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.
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Dialog feature multi language?

Post 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
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Dialog feature multi language?

Post 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.
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Dialog feature multi language?

Post 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
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Dialog feature multi language?

Post by Kukulkan »

Sorry for bothering you, but what is my error? Or is this still not possible?

Kukulkan
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Dialog feature multi language?

Post by Fred »

Yes, it doesn't seem possible for now.
Post Reply