PDA

View Full Version : put unicode chars on a button



primo
13-08-2017, 18:18
while reading a thread about "Insert image in a Button" in powerbasic forum, i got an idea about using unicode characters in buttons whatever that language is hard to "unicodizing" for some programming language.
it is by getting a picture for the word you want to put on your button, edit the picture and save it with irfanview utility to ico file, then use the example XPButton in thinbasic distribution as a template
here is again the thinbasic official example with the russian (ico). just save the russian1.ico to the same folder as the code

uses "UI"
Uses "UIAdv"

Begin ControlID
%IDC_BUTTON1
End ControlID

' ========================================================================================
' Main
' ========================================================================================
FUNCTION TBMAIN() as long

LOCAL hDlg AS LONG

DIALOG NEW 0, "XP Button Demo", 0, 0, 125, 115, %DS_CENTER OR %WS_OVERLAPPED OR %WS_THICKFRAME OR %WS_SYSMENU TO hDlg
' Set the icons (change the names for the ones of your own icons)
Control Add XPBUTTON, hDlg, %IDC_BUTTON1, "", 10, 5, 105, 85, %WS_TABSTOP Or %WS_VISIBLE Or %WS_CHILD

XPButton_SetImagePos hDlg, %IDC_BUTTON1, %XPBUTTON_CENTERCENTER
XPButton_SetIcon hDlg, %IDC_BUTTON1, APP_SourcePath & "russian1.ico", %XPBUTTON_NORMAL
XPButton_SetImageSize hDlg, %IDC_BUTTON1, 128, 64, %TRUE

'XPButton_DisableTheming hDlg, %IDC_BUTTON1

DIALOG SHOW MODAL hDlg, CALL DlgProc

END FUNCTION
' ========================================================================================

' ========================================================================================
' Main Dialog procedure
' ========================================================================================
CALLBACK FUNCTION DlgProc() AS LONG

SELECT CASE CBMSG

CASE %WM_COMMAND
SELECT CASE CBCTL
CASE %IDCANCEL
IF CBCTLMSG = %BN_CLICKED THEN DIALOG END CBHNDL
CASE %IDC_BUTTON1
IF CBCTLMSG = %BN_CLICKED THEN
MSGBOX 0, "Button clicked"
END IF
END SELECT

END SELECT

END FUNCTION
' ========================================================================================


the russian word in the attached ico is юникода which means unicode

mike lobanovsky
18-08-2017, 00:49
No Primo,

The correct Russian translation of an isolated word "unicode" would be "юникод" rather than "юникода". The former is the noun's initial Nominative Case while the latter is its Genetive Case. We are a little cooler grammatically than Brits and Yanks. :cool:

primo
18-08-2017, 18:09
Thank you mike for the info. i have reported to the google translator anonymously in the feedback section your exact sentence: (The correct Russian translation of an isolated word "unicode" would be "юникод" rather than "юникода". The former is the noun's initial Nominative Case while the latter is its Genetive Case. )
so they should evaluate it.
regards

mike lobanovsky
20-08-2017, 02:11
Thank you Primo. Let's make this world a little better. :)