Recent

Author Topic: MessageBox "Yes-No" buttons language and bitmap  (Read 15030 times)

X-Files

  • Newbie
  • Posts: 4
MessageBox "Yes-No" buttons language and bitmap
« on: December 25, 2011, 01:22:37 am »
Hello

I'm new in Lazarus.
1. How can I change MessageBox( ..., ..., MB_YESNO) buttons caption from english (Yes, No) to my national language?
2. How can I remove bitmaps from these buttons (or how can I use my own bitmaps)?

Thx!

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: MessageBox "Yes-No" buttons language and bitmap
« Reply #1 on: December 25, 2011, 02:32:27 am »
Code: [Select]
QuestionDlg('Title','Question?',
              mtCustom,  // removes the bitmap
             [mrYes,'YesOnYourLanguage',mrNo,'NoOnYourLanguage'],0); 
« Last Edit: December 25, 2011, 02:34:59 am by typo »

Bart

  • Hero Member
  • *****
  • Posts: 5663
    • Bart en Mariska's Webstek
Re: MessageBox "Yes-No" buttons language and bitmap
« Reply #2 on: December 25, 2011, 04:29:12 pm »
The "proper" way is to use the Translations unit to translate all resources strings from lclstrconsts.pas.

See  this wiki article.

You can add the po-file in question as a Lazarus resource to your program if you want. I have some code for that.

Bart

X-Files

  • Newbie
  • Posts: 4
Re: MessageBox "Yes-No" buttons language and bitmap
« Reply #3 on: December 25, 2011, 11:56:22 pm »
Thx for answers.
I want to compile resource file into exe.
Bart, if you have some code for that, send me if you can.

Bart

  • Hero Member
  • *****
  • Posts: 5663
    • Bart en Mariska's Webstek
Re: MessageBox "Yes-No" buttons language and bitmap
« Reply #4 on: December 26, 2011, 01:59:50 am »
Take a look at my autotranslation unit.

To make the resource you have to use lazres (the sources for lazres come with lazarus).

Code: [Select]
lazres resourcefilename somepofile.po

Then include the created .lrs in the autotranslation unit, instead of my dutch one, and adapt the source to make it use your po-file.

Bart

X-Files

  • Newbie
  • Posts: 4
Re: MessageBox "Yes-No" buttons language and bitmap
« Reply #5 on: December 27, 2011, 01:57:09 pm »
Bart - Like I said, I'm new in Lazarus, so translating is too much complicated for me. So many combinations to display "Ja" and "Nee" (example, I'm not a Dutchman) on buttons?
typo - your way is better for me. mtCustom removes nothing, is same as mtInformation. It's OK, no problem. My question is: how I can remove glyphs from buttons or how I can use my own glyphs?
« Last Edit: December 27, 2011, 01:59:01 pm by X-Files »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: MessageBox "Yes-No" buttons language and bitmap
« Reply #6 on: December 27, 2011, 02:47:07 pm »
For me it removes.

Lazarus 0.9.31 r33012 FPC 2.5.1 i386-win32-win32/win64

Bart

  • Hero Member
  • *****
  • Posts: 5663
    • Bart en Mariska's Webstek
Re: MessageBox "Yes-No" buttons language and bitmap
« Reply #7 on: December 27, 2011, 06:31:31 pm »
Maybe you better write your own messagebox form.
This gives you absolute control over buttons, icons etc.

Bart

X-Files

  • Newbie
  • Posts: 4
Re: MessageBox "Yes-No" buttons language and bitmap
« Reply #8 on: December 28, 2011, 12:18:11 am »
Bart - you're right, I have to write my own messagebox.

typo - for me mtCustom is same like mtInformation.

Lazarus 0.9.31 r34358 FPC 2.5.1 i386-win32-win32/win64

Thank you for your answers.

Shebuka

  • Sr. Member
  • ****
  • Posts: 429
Re: MessageBox "Yes-No" buttons language and bitmap
« Reply #9 on: January 09, 2012, 11:29:23 am »
The "proper" way is to use the Translations unit to translate all resources strings from lclstrconsts.pas.

See  this wiki article.

You can add the po-file in question as a Lazarus resource to your program if you want. I have some code for that.

Bart

Hi, is it a known bug that on Carbon it's not working? (At least for MessageBox...)

Also, if i understand right i must include in some place all lclstrconsts.%s.pas i use into my MacOS X Application Bundle? Or there is more simple way, like include inside the executable?

Bart

  • Hero Member
  • *****
  • Posts: 5663
    • Bart en Mariska's Webstek
Re: MessageBox "Yes-No" buttons language and bitmap
« Reply #10 on: January 09, 2012, 11:43:42 am »
See my previous post. You can add the languagefiles as a resource to your program.
Not sure if this is a real-life solution if you want to support all languages.
Also, you cannot update languagefiles without updating the executable in this way.

Bart

 

TinyPortal © 2005-2018