Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: caption at mdi form


Message #1 by "azian mohamad" <amohamad_my@h...> on Thu, 14 Mar 2002 06:33:16
A possible solution could be to have each menu item you want in both
languages as a menu array (menus with different caption, same name and
different index) so you can switch from one to another by using the visible
property.

VERSION 5.00
Begin VB.Form Form1
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command2
      Caption         =   "Malay"
      Height          =   375
      Left            =   2250
      TabIndex        =   1
      Top             =   750
      Width           =   1095
   End
   Begin VB.CommandButton Command1
      Caption         =   "English"
      Height          =   375
      Left            =   960
      TabIndex        =   0
      Top             =   750
      Width           =   1065
   End
   Begin VB.Menu mnuPrint
      Caption         =   "&Print"
      Index           =   0
   End
   Begin VB.Menu mnuPrint
      Caption         =   "&Cetak"
      Index           =   1
      Visible         =   0   'False
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
   mnuPrint(0).Visible = True
   mnuPrint(1).Visible = False
End Sub

Private Sub Command2_Click()
   mnuPrint(1).Visible = True
   mnuPrint(0).Visible = False
End Sub

Private Sub mnuPrint_Click(Index As Integer)
   Select Case Index
      Case 0
         MsgBox "Now menu is in English"
      Case 1
         MsgBox "Now menu is in Malay"
   End Select
   MsgBox "But still can execute the same code"
End Sub

Regards,

----- Original Message -----
From: "azian mohamad" <amohamad_my@h...>
To: "professional vb" <pro_vb@p...>
Sent: Thursday, March 14, 2002 6:33 AM
Subject: [pro_vb] caption at mdi form


> Hi experts,
> I know that at design time we can set the file menu of mdi form with
> shortcut keys, eg &File where "F" is underline and users use ALT+F to
> access it.
>
> But how can I change the caption during run time and still have the
> shortcut keys ? I need to change during run time due to language setting,
> where the caption I read from resource file.
> Eg:
> English (Default)              Malay (language setting)
> Print (P is underline)         Cetak (C is underline)
>
> So I want to change during runtime from &Print to &Cetak.
>
> How to do this?
>
> Thanks in advance.
> //azian
>



_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com




  Return to Index