Announcement

Collapse
No announcement yet.

MSGBOX - Changing default answer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Egbert Zijlema
    replied
    Borje,

    I'm quite sure, Windows has no 'locales' for MsgBox controls.
    Windows API has a function MessageBoxEx. You can pass a language-ID here, but as far as I've experienced it does not work in the way you're thinking of.
    Code:
    dummy& = MessageBoxEx(0, szMessage, szCaption, MAKLNG(%LANG_DUTCH, %SUBLANG_DUTCH))
    does not create Dutch controls with a non-Dutch Windows version. It only works on a computer whith a Dutch version of Windows installed. But... the normal MessageBox FUNCTION, so without the LangID-param, does exactly the same thing. In other words MessageBoxEx is rather useless. See: http://support.microsoft.com/support.../Q152/6/70.asp

    Semen,
    Thanks for replying to my MAKELANGID question, elsewhere in this Forum.


    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/



    [This message has been edited by Egbert Zijlema (edited March 14, 2001).]

    Leave a comment:


  • Egbert Zijlema
    replied
    Message deleted
    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/



    [This message has been edited by Egbert Zijlema (edited March 14, 2001).]

    Leave a comment:


  • Borje Hagsten
    replied
    This is probably only a problem outside English-speaking countries.
    We use a lot English-speaking software and while messages usually
    are in English, standard buttons, etc. still are in native language.

    Not that people ever seem to read what it says in messages/on buttons,
    but still - it would be nice to be able to find a way to get the local
    resource strings, that obviously do exist. In my USER32.EXE, I can see
    some of them. Each language version seems to have their own strings, but
    resource id's should be the same.

    I'll see if I can find a way to get hold of them later on..


    ------------------

    Leave a comment:


  • Egbert Zijlema
    replied
    Hey John!
    It is just to demonstrate how to change the text for the buttons. Of course the message itself should be in the same language, but that is not the important thing here..


    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Leave a comment:


  • John Kovacich
    replied
    What good is a local language on the buttons if the message remeains
    the same? Isn't it the programmers responsibility to change the language
    of the message, at which time he/she can select the correct button
    phrases as well?

    ------------------
    Thanks,

    John Kovacich

    Leave a comment:


  • Egbert Zijlema
    replied
    Hi fellows,

    In the source code forum you'll find code to produce message boxes with button texts in your own language.

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Leave a comment:


  • Semen Matusovski
    replied
    Actually a question is deeply.
    Problem with standart Msgbox is that Yes/No or Ja/Nein depends of Windows release only and do not depepend of language settings.
    (BTW, reshacker shows me in kernel32.dll (Win2000) russian strings only).

    Problems with own dialogs: could be another charset.
    Unf. even setting a font with own charset doesn't fix a problem (for example, in Win2000).
    Own-drawn buttons only.

    The same story with menu, caption and so on.

    ------------------
    E-MAIL: [email protected]

    Leave a comment:


  • Egbert Zijlema
    replied
    Interesting question, Borje.
    Although.... what to think about this situation? For some or another reason our company installed an English version of Windows. Our regional settings are correctly set to "Dutch(standard)". So screen output for month- and day names is in Dutch. But the controls of a message box appear in English. Therefore I write my own MB's with Dutch text for the controls.
    But you are right, if your applications are ment for world wide use, it would be a good thing if Windows could provide 'yes', 'no', 'cancel' and that sort of words as locales.

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Leave a comment:


  • Borje Hagsten
    replied
    Problem with writing own dialogs is language. Users expect Yes/No/Cancel
    buttons to be in their own language, which is Ja/Nej/Avbryt in Swedish,
    for example.

    Which brings me to a question - shouldn't it be possible to get hold
    of these language specific strings via some API call? Windows obviously
    can change language via our language settings, so somewhere, there must
    be a table containing all these strings.

    If one knows what Id goes to what string, that would enable writing
    enhanced controls and dialogs, like a MessageBox, that looks just
    like a part of Windows, all the way..


    ------------------

    Leave a comment:


  • Egbert Zijlema
    replied
    Why not write a dialog by yourself? Here's an example.
    Code:
    #COMPILE EXE
    #INCLUDE "WIN32API.INC"
     
    CALLBACK FUNCTION Buttons()
      SELECT CASE CBCTL
        CASE %IDYES
          MSGBOX "You clicked the no-button", 64, "Debugging......"
        CASE %IDNO
          MSGBOX "You clicked the yes-button", 64, "Debugging....."
      END SELECT
      DIALOG END CBHNDL, 0
    END FUNCTION
     
    SUB MessageDialog(caption AS STRING, message AS STRING)
      LOCAL hMB AS LONG, hIcon AS LONG, x AS LONG
     
      DIALOG NEW 0, caption, , , 220, 70, %WS_CAPTION OR %WS_SYSMENU TO hMB
      CONTROL ADD LABEL,  hMB, %WM_USER + 1, "", 10, 21, 0, 0, %SS_ICON
      CONTROL ADD LABEL,  hMB, %WM_USER + 2, message, 30, 21, 180, 28
      CONTROL ADD BUTTON, hMB, %IDYES, "No", 160, 50, 50, 14, %BS_DEFAULT OR %WS_TABSTOP CALL Buttons
      CONTROL ADD BUTTON, hMB, %IDNO, "Yes", 100, 50, 50, 14, %WS_TABSTOP CALL Buttons
      SysMenu& = GetSystemMenu(hMB, %FALSE)
      DeleteMenu SysMenu&, %SC_CLOSE, 0
      hIcon = LoadIcon(0, BYVAL %IDI_QUESTION)
      SendDlgItemMessage hMB, %WM_USER + 1, %STM_SETIMAGE, %IMAGE_ICON, hIcon
      DIALOG SHOW MODELESS hMB
      DO
        DIALOG DOEVENTS
        DIALOG GET SIZE hMB TO x, x
      LOOP WHILE x
    END SUB
     
    FUNCTION PBMain() AS LONG
      MessageDialog "Caption", "Do you really want to...."
    END FUNCTION
    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Leave a comment:


  • Borje Hagsten
    replied
    Add %MB_DEFBUTTON2 to style. Or %MB_DEFBUTTON3, %MB_DEFBUTTON4, depending
    on how many buttons there are. %MB_DEFBUTTON1 is default.

    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest started a topic MSGBOX - Changing default answer

    MSGBOX - Changing default answer

    Hello

    I'd like to set the default answer to NO on YES/NO MSGBOX's.
    By default, if user hits return on MSGBOX answer is always YES.
    I want the default answer to always be NO.

    all help appreciated
    thanks
    Mike C


    ------------------
Working...
X