
- Purebasic string extension rar#
- Purebasic string extension code#
- Purebasic string extension windows#
The buttons and such are fine but the window title won't change.
Purebasic string extension windows#
I have it set on my home computer and all of it shows fine but at work I don't have Asian character support set so the title of the windows shows as blocks. Oh, the title of the test unicode app may not show up as Japanese characters if you don't have the proper language support set. If EraseOriginal = #True : FreeMemory(inString) : EndIfĪnd that's about it. ReturnString = AllocateMemory((Length * 2) + 2)ĬopyMemory(inString + ((StartPosition - 1) * 2), ReturnString, Length * 2) Make sure our length fits within the length of the passed string.

If StartPosition HoldLength Or Length = 0 : Length = HoldLength - StartPosition + 1 : EndIf If our start position is more than the length of the file, exit. If StartPosition > HoldLength : ProcedureReturn ucReturnEmpty() : EndIf Store the length of the passed string (in characters). This is the length of the passed string. This is the wide character equivalent of the Mid() procedure. Here's an example of one of the string functions so you can get an idea of how they look.Ĭode: Select all Procedure.l ucMid(inString.l, StartPosition.l, Length.l, EraseOriginal.b) Pass Length = 0 for the rest of the string. Be sure to back up the existing libraries before you copy these over. To use these functions you'll need the W functions from MS so I've included custom *.lib files that should be placed in their appropriate directories (PureLibraries\Windows and PureLibraries\Windows\Libraries). I tried to make them somewhat quick but with only varying results. Two functions to test for a null or empty string, a function to remove delimited string duplicates and a few others. There are also some custom functions like ucCopyString() to completely copy one unicode string into another. There are uncode equivalents of the PB functions - StringField, CountString, FindString, Trim, Mid, Right, Left, RSet, LSet, Len and Str. There are several functions to add strings together (ansi or unicode). There are a lot of supplemental functions to do various things with the string builder as well so check out that part of the code. Should be pretty quick for appending unicode text. For insert strings it has - sbAdd() to add a wide character string, sbAddChar() to add a word value and sbAddAnsi() to add ansi text to our string builder as wide characters. This way you can start the string builder and quickly add strings for whatever task you need. So here's what's included in 'Unicode.pb'.Ī wide character string builder. The main intention is just to have unicode functions available for wide format string manipulation. However, that's not the main intention of the post.
Purebasic string extension rar#
The test program is 'Unicode-Test.pb' in the included rar file.
Purebasic string extension code#
Feel free to browse the unicode gadget/window code and see how all of that works. For example, to enumerate the gadgets/windows, I create a custom heap and walk through the heap to locate the required gadget or window. It was actually kind of fun to do and the Window/Gadget code has a few neat tricks in it if you dig through them. If EventTypeW() = #PB_EventType_LeftClickĭoes it look familiar? I know Fred plans unicode support later on but I wanted to learn some things so I fiddled with making a 'Unicode PB' of sorts. If EventID = #PB_Event_CloseWindow : doQuit = #True : EndIf StringGadgetW(#StringTest, 0, 41, 200, 20, HoldString, 0)

TextGadgetW(#TextTest, 0, 21, 200, 20, HoldString, #PB_Text_Border | #PB_Text_Center)

Turn on advanced events for our unicode button gadget.īuttonGadgetW(#ButtonClose, 0, 0, 100, 20, HoldString, 0) HandleWindow.l = OpenWindowW(#formMain, 216, 0, 450, 150, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar, HoldString, 0) Initialize our unicode functions with out default font. UnicodeInit("Arial Unicode MS", 8, 0) Style uses the #PB_Font_Bold, etc.
