How to Multi-Language + Multi-Form + Tab in one exe file

You need some new stunning features ? Tell us here.
hoangdiemtinh
User
User
Posts: 29
Joined: Wed Nov 16, 2022 1:51 pm

How to Multi-Language + Multi-Form + Tab in one exe file

Post by hoangdiemtinh »

I am learning from my predecessors and want to build a small application related to image conversion.

I plan to use a Control named Panel.
Can add Button, Text box,... to Panel ? (Panel1 = Convert Image, Panel2 = ReSize Image, Panel3 = Image Information, Panel4 = About app).

Can add 1 Window (eg: Settings), including 2 buttons OK and Cancel.

I need an interface that supports 2 languages, Vietnamese and English.
Is it possible to add 2 languages and the user to change the display language on the interface without re-running the application?

Thanks.
juergenkulow
Enthusiast
Enthusiast
Posts: 544
Joined: Wed Sep 25, 2019 10:18 am

Re: How to Multi-Language + Multi-Form + Tab in one exe file

Post by juergenkulow »

Code: Select all

; en, vi ,de
Dim LangArray.s(2,2)
Global lang=0 
Global Window_0
Global Button_0, Text_0, String_0

Procedure buttonEvent(EventType)
  Shared LangArray.s()
  If lang=ArraySize(LangArray(),1)
    lang=0
  Else
    lang+1
  EndIf 
  SetGadgetText(Button_0,LangArray(lang,0))
  SetGadgetText(Text_0,LangArray(lang,1))
  SetWindowTitle(Window_0,LangArray(lang,2))
EndProcedure

Procedure OpenWindow_0(x = 0, y = 0, width = 300, height = 200)
  Shared LangArray.s()
  Window_0 = OpenWindow(#PB_Any, x, y, width, height, LangArray(lang,2), #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
  Button_0 = ButtonGadget(#PB_Any, 50, 120, 200, 30, LangArray(lang,0))
  Text_0 = TextGadget(#PB_Any, 50, 30, 200, 30, LangArray(lang,1))
  String_0 = StringGadget(#PB_Any, 50, 70, 200, 30, "")
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
        Case Button_0
          buttonEvent(EventType())          
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure

LangArray(0,0)="Click Me" : LangArray(1,0)="Nhấp vào Tôi" : LangArray(2,0)="Klick mich"
LangArray(0,1)="This is a label..." : LangArray(1,1)="Đây là một nhãn hiệu..." : LangArray(2,1)="Dies ist ein Label ..."
LangArray(0,2)="My Window" : LangArray(1,2)="Cửa sổ của tôi" : LangArray(2,2)="Mein Fenster"

OpenWindow_0()

Repeat
  event = WaitWindowEvent()
Until Window_0_Events(event) = #False

End
Please ask your questions, because switch on the cognition apparatus decides on the only known life in the universe.Wersten :DDüsseldorf NRW Germany Europe Earth Solar System Flake Bubble Orionarm
Milky Way Local_Group Virgo Supercluster Laniakea Universe
hoangdiemtinh
User
User
Posts: 29
Joined: Wed Nov 16, 2022 1:51 pm

Re: How to Multi-Language + Multi-Form + Tab in one exe file

Post by hoangdiemtinh »

thank juergenkulow . I will do as your recommendation. And also following Hex0r Dialog Designer
Post Reply