Page 1 of 1

Basic Unicode Button & String Gadget

Posted: Sat Apr 30, 2005 1:17 am
by Xombie
Well, after getting some pointers last night from Derlidio and noticing a few bits and pieces of code here and there on unicode stuff, I decided to try and see if I could make a unicode control.

I *think* I did it. Very very veeeeeery basic controls for these two. Took me about 6 hours to mash together. Since I'm at work :twisted: I can't log in to my ftp to upload the files so I'll paste them in replies after this. There five files.

The main file is called "Unicode-Test.pb" and is the file that runs all the other included code. The first include is "UnicodeInclude.pb" and contains a couple of helper procedures. The next is "uButtonGadget.pb" which contains the code to create a (hopefully) unicode Button gadget. Also, "uStringGadget.pb" is used to (really really hopefully) create a unicode String Gadget. Last is the INI file that stores the unicode strings. I include it as my little test thing but after you look at the code you can see how I interact with it and make your own INI file. Just remember it needs to be saved with Unicode encoding (see the ReadUnicodeINI() procedure in 'UnicodeInclude.pb' for reading values from a unicode ini file).

These aren't meant to be an end-all-be-all solution. Just mainly to see if it's possible. Again, Linux fellas, I'm sorry - I only know Windows development :cry: So these only work on Windows. Well, I *hope* they are working for other people. Be sure to use a font that supports unicode characters. Pass that font name in the gadget creation. I used "Arial Unicode MS" because that's what I've got at home and at work.

I didn't really delve in deep and make these things super-solid. There are a lot of things missing, incomplete bug checking... yatta yatta yatta... I built them based off of my xMask control and then just changed things for unicode. Probably not speedy if you're doing a whole bunch of unicode reading & text setting at once. :shrug:

Anyway, I'll paste each of the files into a separate reply so that they don't hog up 1 post. Or at least, I'll try. Look at the example on how it's used.

Let me know if it actually works. As time goes on and no other better opportunities present themselves - I'll probably try adding more unicode gadgets and more functionality. I'll see about it while Fred works on PB 4.0. Creating a unicode button and string gadget is basically a test run to see if it's even possible to accomplish this in PB without doing totally weirdo stuff.

Have fun and good luck with it! :D

UPDATE

Okay, home now so here is the link to download all of them at once, including the unicode encoded text file. Be sure to update the location of the file in the test file.

Download here: Unicode Test

Posted: Sat Apr 30, 2005 1:18 am
by Xombie
(Removed: See download link in first post )

Posted: Sat Apr 30, 2005 1:19 am
by Xombie
(Removed: See download link in first post. Wish I could delete all of these posts >_< )

Posted: Sat Apr 30, 2005 1:21 am
by Xombie
(Removed: See download link in first post )

Posted: Sat Apr 30, 2005 1:22 am
by Xombie
(Removed: See download link in first post )

Posted: Sat Apr 30, 2005 1:23 am
by Xombie
(Removed: See download link in first post )

Posted: Sat Apr 30, 2005 3:44 am
by sec
I like unicode (UTF-8 ).
What i look, does it work?
Image

Posted: Sat Apr 30, 2005 3:57 am
by Xombie
Did you change this line...

#c_UnicodeFile = "test.txt"

in Unicode-Test.pb? It needs to point to the location of the file. Like "c:\unicode\test.txt" or wherever you saved it. I've only tested saving in plain unicode encoding. I haven't tried utf-8 encoding yet. And then once you load the program, click the "Tester" button to try it out. And some unicode text should appear in the string gadget that says "No Key Found". Also, you should be able to test it immediately but typing or pasting some asian, russian, whatever text into the first string gadget (the one that says "No Key Found" right now). Otherwise, change #c_UnicodeFile to point to the test.txt file.

Hope that helps! Sorry for the ugly test form. I just wanted something quick ^_^