# VBForums UtilityBank > UtilityBank - Components >  VB6 UniControls Summer Release [2008-06-19]

## Merri

UniControls: 2008-06-19
UniText RC3 & UniList RC1: 2008-06-14


I've finally come to a point at which I'm happy enough to the results: my unicode controls as solid standalone one file user controls. LaVolpe's version of Paul Caton's SelfSub and SelfHook are being used to gain something that has been very hard before.

These controls are aimed to be basic controls, with a little twist or two. UniLabel is currently the only control that is nearly polished to it's maximum, it has one remaining issue with transparent ZOrder. Other controls are still on beta level: UniMenu needs work on easing it's usage, UniText needs polishing and adding functionality, UniCommand is an non-subclassed older version which will be replaced by subclassed one once I've resolved a few issues.

Feedback and bug reports very much appreciated!

----------


## Meeko

Thanks for the controls,

I'm now trying the unitext,
but once I close the form with the unitext, it appears an "invalid procedure Call or argument" at the line

""If thunkID <> 0 Then z_scFunk.Remove "h" & thunkID"

But it's ok to execute the program!!

----------


## Merri

Yeah, this is a known problem. I fixed it already at one point (after the release), but after messing around the code it is back in my current source. Will see if I get it fixed for the next release.

----------


## Merri

Time for the 2007-12-15 release!



What is new:UniText and UniMenu are now editable: select control, right click, Edit.UniLabel Caption is now presented in UTF-8 in the properties window.Tons of code reordering, variables renamed etc.Fixed lots of bugs (I don't keep a detailed list).Rewrote UTF-8 <-> UTF-16 conversion code in UniMenu, UniLabel and UniText.UniText's Text property has been hidden from the properties window to prevent accidental removal of Unicode text.

Known issues:You can't use arrow keys in UniText when editing in design time.UniText doesn't subclass within UniMenu, thus pressing Set is required.Setting KeyAscii in KeyPress event of UniText doesn't work.Focus of UniText is partially lost if window focus changes.

----------


## Merri

I have some nice news for you all: the next version of UniLabel will support Vista's themed text, meaning you can have glows, shadows and borders around text when your app runs on Vista.

At this point I already have support for glowing text and I don't think it would be too hard to add support for the rest.

----------


## Merri

Left one with solid background, right one with transparent background. So as you can see, there is a bug remaining with the transparent background. For some reason it doesn't draw properly the first time window pops up back to being visible. I'll just have to figure out why.


At this point...

New properties: Border, BorderColor, Glow, Shadow, ShadowColor, ShadowX, ShadowY, UseThemeText

New methods: SetShadow, SetShadowOffset, ThemeText


ThemeText returns True if DrawThemeTextEx can be used. It can't be used when Vista's theming is disabled and classic theme is being used instead.

----------


## Meeko

I am not able to input chinese characters in a English OS, and some characters in the UniText1 has become "??" both in Chinese and English OS.

----------


## Merri

Could you give more details? Which version and what did you do?

*Edit!*
I tried to write some Chinese and it worked ok. Not that I understood anything of what I wrote, but the characters came out like they're supposed to. This on a Finnish Vista.

----------


## Meeko

I just execute the sample project in my pc, which is in Chinese XP, and type chinese in UniText2.



I've also tried in an English Win 2000 PC.

----------


## Merri

There is one possible place when characters don't go the Unicode route, so lets rule that one out: open UniText source, locate UserControl_ReadProperties and the following line:

If ssc_Subclass(UserControl.hWnd, , 1, , Ambient.UserMode) Then

change to

If ssc_Subclass(UserControl.hWnd, , 1, , Ambient.UserMode, True) Then

This should change the subclassing of messages of the usercontrol itself (not the textbox that has been created using API) to Unicode. This may cause other problems or not, but lets see if this has any effect for the Chinese not working.

Other than this, I don't have an idea at this point what might cause the problem.

----------


## Meeko

I've tried modify the line but seems not working,
only some part of the Japanese (Unitext1) could now be visible in the Chinese OS.

Thanks.

----------


## Merri

See the regional settings and check if the setting for possible alternative fonts is checked. On English XP, you have to tick option "Install fonts for Far East languages" or something similar to be able to see Chinese, Japanese, Korean etc.

I can't remember what you have to do with Windows 2000 to get the fonts.

----------


## Herman CK

I've taken out UniTextBox user control alone for test and found it the best of all approaches I've come across so far.

I've been able to (1) use Hand Writing Device to input Chinese characters ("Simple Chinese") and (2) paste the same from WordPad to UniTextBox alright.

One problem encountered, however.  When I wanted to change the "Project Name" property of the Project, the screen flagged "Thunk hasn't been initialized".   At the end, I have to re-start the computer.

The test was done on XP and Vista.  I also tried it on ME, understandably it wouldn't work there, just a mention.

I've meanwhile added some properties to the user control, such as FontName selection, CharSet selection (Font's Script No.), FontSize, Bold, Italic and Underline.  All worked fine.  If you want me to send you my test project (so that you might save some typing), I can contact you via the mail system of Plant-Soure-Code.

Regards,

----------


## Herman CK

Regarding the outstanding issue on your uniTextBox (you listed the issue earlier on), it seems that if you set the ForwardFocus property of the user control to True, then you will regain focus on return after losing focus to another window such as WordPad.

----------


## Merri

Focus overall is a hard issue, the default behavior involved with how user controls behave is troublesome with controls such as a textbox that involve using keys such as tab, enter and arrows. The regular user control behavior have to be cancelled in one way or another, which isn't yet done perfectly. The only "good" solutions involve using a type library, which isn't something I'm a fan of due to a requirement of an extra file while I want it all to work from one. I have ended up to capturing keys by hooking, which isn't as clean I'd want it to be...

----------


## LaVolpe

Merri, if you are still updating this project, here is an issue that you may want to examine.  When textbox has focus, press F10 (activates menubar), try to use keyboard to navigate menu.  Just trapping the F10 won't solve the problem though.  If textbox has focus, click on the menu File, now try to use keyboard to navigate menu.  I think the solution is to actually subclass the parent form and look for menu loop messages to determine when to allow right/left, up/down arrows to flow thru.   Of course, subclassing the form by multiple usercontrols always leads to problems.

Anyway, I got re-interested in combining VB with API Windows and have encountered this problem.  I came to your post, wondering if you had a cure for it.

----------


## LaVolpe

Merri, figured it out should you want to attack same problem.  Here's what I had to do:
1) Only on wm_setfocus, start keyboard hook and also subclass the top-level window.  If wm_entermenuloop or wm_contextmenu happens, release keyboard hook and restart hook on wm_exitmenuloop or after wm_contenxtmenu returns, but only if control still has focus. Note that wm_contextmenu can occur both in the top level window and the api window too.
2) On wm_killfocus, release keyboard hook always

----------


## Merri

Ok, thanks, I probably get back into the project again some day, I'm very much of an on/off person when it comes to programming  :Smilie: 

Atm reading to Helsinki university entrance test.

----------


## Merri

I'm back working on the controls. However I've made a change in how I work with the project: I've given up on hooking, it just is all too messy, instead I've included an IOLEInPlaceActivate replacement module and two different TLB files to fix the issue the correct proper way.

This means the controls won't be as standalone as they used to be. In the other hand I'm aiming on having only one extra module. As a bonus though, I'm currently working on UniRich control to have an Unicode Richtextbox, and it'll need some extra class modules for usability's sake. I'm basing my work on Edanmo's excellent but IDE crashy RichEdit control, which I'll convert to SelfSub to gain stability and compatibility with my other controls.

I originally started working on my IRC client, Goldpanda, but I soon noticed three different methods for subclassing between the various components only resulted in very-very-hard-to-debug crash issues. It looks like I need to write my own WinSock replacement as well, CSocketMaster just doesn't cut it anymore, so I'll convert that to SelfSub as well (and probably do some other changes when I'm at it).


The control list is getting pretty long:clsSockUniCommandUniLabelUniListUniMenuUniRichUniText
Just knowing that I have to rewrite tons of code doesn't sound too fun...

----------


## Merri

UniText RC3 release is open for bug testing, I'd like people to check if there are any bugs or only partially done features. The control can save and load Unicode text files. UTF-7, UTF-8, UTF-16, UTF-32, big endian, little endian... all those are supported. Many codepages are also supported for loading and saving, so you can load a GB 18030 encoded text file.

UniList RC1 is also in the package. It lacks support for checkbox style but other than that it should work pretty good.

----------


## Merri

2008-06-19


Finally a new UniControls main release. It isn't as polished as I'd like it to be, but I find it better to release often when I'm at it so here we are.

Things we have here now:UniCaption (Unicode caption for forms)UniCommand (command button)UniDialog (common dialog & browseforfolder; this one needs still a lot of work)UniLabel (the most polished of these controls)UniList (listbox: sorting has much more power thanks to locale selection)UniMenu (ownerdrawn menu, lots of options for colors)UniText (textbox with wide range of Unicode support)

There is also some bonus code  :Smilie:

----------


## tanjiunnyann

Merri, what time do you want to update your UNICODE control again? I'm waiting your next release of the updated Unicode Control pack! ^.^

----------


## Merri

I have some rewriting to do thanks to some new coding techniques that I've found since the latest release, and knowing how much time I have it may take anything from several weeks to a few months.

I'd also have to let some of the controls go, especially UniMenu, it is oldest by codebase and most likely the greatest cause of unexpected crashes (especially under IDE).

----------


## keep_touch81@yahoo.c

Can u give me a sample code of simple dropdown combobox that support unicode character.

----------


## si_the_geek

Welcome to VBForums  :wave: 

As it has not been done already, the easiest thing to do is build your own using a combination of UniText (for the part that is usually displayed), UniList (for the drop-down list) and a command button (for the drop down button).

----------


## Merri

You can find Unicode combobox over at Planet Source Code. Not done by me.

----------


## udayphadkepune

> Can u give me a sample code of simple dropdown combobox that support unicode character.


You can add component "Microsoft forms 2.0 object Library". Then you will get new tool box. take combobox tool from that and apply it.

uday phadke

----------


## si_the_geek

Welcome to VBForums  :wave: 

You can add it to your project, but it is illegal to distribute it (so your program will only work if it is already installed).

From Microsofts web site:



> The Fm20.dll is NOT redistributable. You must have an application such as Microsoft Office 97 on the target system that installs Fm20.dll as part of its setup. (Fm20.dll is included with the OSR2 and OSR2.5 releases of Windows 95.) You can also find this file on the Visual Basic 5.0 CD under the \TOOLS\DataTool\Datatool\Msdesign folder. This will be installed only if you run the setup for the Visual Database Tools. In any case, you may not distribute the Fm20.dll as part of your setup, even if you purchase the Microsoft Office Developer Edition product.

----------


## keep_touch81@yahoo.c

Hi Merri! Thanks for your reply.
Can you help me regarding your unitooltip text project. It is not working.

----------


## pinkduck

The quality of Merri's code is brilliant  :Smilie:  Fantastic stuff.

That said, I'd like to point out that if the UniText control has the Locked property set, then the keyboard shortcut for Copy (Ctrl-C) is not passed through in the TranslateAccel method of the UniText.ctl file.

----------


## Merri

There are lots of oddities still in the code, but it is more than likely they'll never end up being fixed. Now that I'm more or less successfully entered work life I don't have the time resources I used to have, and programming wise I don't know which language I should pick up now that VB6 is slowly dying away. And I do a lot of other things besides programming (game translations, game modding, websites...).

----------


## firoz.raj

Hi ,Marry why in the following code it says .Client Side Not Available???.Error is Comming at Red Line !.let me know some idea please .

```


Private Sub UserControl_Initialize()
    m_WINNT = (Environ$("OS") = "Windows_NT")
    On Error Resume Next
    m_ExtenderScale = UserControl.Extender.Container.ScaleMode
    If Err.Number Then
        Err.Clear
        m_ExtenderScale = UserControl.Parent.ScaleMode
        If Err.Number Then
            Err.Clear
            m_ExtenderScale = vbTwips
        End If
    End If
    On Error GoTo 0
End Sub
```

----------


## Merri

During UserControl_Initialize the UserControl.Extender is not yet created. You have to do the call in UserControl_InitProperties (when the control is created for the first time in IDE) and UserControl_ReadProperties (all other cases).

In the recent EruLabel that I posted I think I had a better method for ScaleMode checking, but I'm not entirely sure. I did something better than I've done previously, I think.

----------


## mafommao

"VB6 is slowly dying away"
it can be raised up by real VB6 hobbyists,i believe,though many people think it's impossible,
your developments are wonderful,keep enthusiasm on them Merri!! i support u!!!
-- a VB6 hobbyist from china,don't laugh at my english,thks.

----------


## coderx

How do you do, dear Marri.
I have looked your UniControl.
If I shall press the keys "қ" on UniText, that he does not show them, together he shows "?".
But if put Msgbox "" here:


```
Private Function Private_WndEventKeyboard(MF As MSGFILTER) As Long
    Dim intShift As Integer
    Dim intChar As Integer
    Select Case MF.Msg
      Case WM_KEYDOWN
          ' set the intShift parameter
          intShift = Private_GetShiftMask
          ' set the KeyCode parameter
          intChar = MF.wParam And &HFFFF&
          ' raise the event
          RaiseEvent KeyDown(intChar, intShift)
          MsgBox ""
```

It is сorrect shows, problem in than can be?

----------


## Merri

I haven't taken a look into the source in a long time, but I think KeyDown, KeyPress & KeyUp are implemented incorrectly. They'd need a fix, but at the moment I have no interest to continue the project. A lot of these controls were written in "learn by doing" style, so there are some places where things are not done as they should've been done. I'd pretty much would like to write the controls again from nothing, using old code as reference, but I don't have the time to do that.

----------


## coderx

As possible correct it? Can be I itself shall correct.

----------


## negrem

Good day!
I downloaded unicontrold but they don't work on my computer


I was write on kazakh language in it, but it's writing like ???? ??? (ҚҰҮҒҢӘ)

----------


## Nightwalker83

You need to install the language pack for any language you want to use.

----------


## MrSmoofy

So these controls seems to be what we are looking for except I'm having an issue.

When I open the sample project I'm able to type ALT-0156 and it shows the correct character.

When I add a new form to the same project and add a UnitText box to it and try the same test it shows a black line intead of the expected unicode character.

----------


## coolcurrent4u

this is cool merri, any hope to add unicode toolbar, and listview?

----------


## Merri

Sorry, I no longer develop for VB6. Mostly PHP and JS these days, later on probably BlitzMax or C++ if I have the time.

----------


## mowan1979

I've been programming for many years and I have never found code for this particular program online. I guess you'll have to write it yourself. That is, after all, the best source for homework code.

----------


## kirti_sm25

Hi Merri, not sure if you are still following this thread, if so please reply to my query asap. I am using your 2007's Unicode controls. In that I am facing problem with UniMenu. When I set the caption in Menu Editor, it works fine and displays the unicode values correctly. But, when I am passing value to Caption runtime, it is getting displayed as '??'. When I debugged and checked the variable value which is passed to Unimenu.Caption, it is also getting passed as '???'. May be this is the reason why its not getting displayed correctly.

But, I have used UniLabels and in that also I have set values using variables and these variables during debug shows values as '???', but still the values getting displayed on the form are correct. They appear in Chinese and Japanese both.

So, setting caption runtime works fine with UniLabels but not working for UniMenu. Can you please help!!

Thanks,
Kirti

----------


## Elroy

Here, full unicode support in both design mode and during runtime for VB6.
Complete source code.

OptionButton

Checkbox

Label

CommandButton

File I/O

Clipboard I/O

Other routines for putting Unicode into the caption of any VB control with a hWnd,
including forms.

Just download from here and you're all set:

http://motionlabresources.org/Unicode%20&%20RTF%20for%20VB6.zip

Also, a Unicode textbox could easily be developed from this.  I just haven't had a need for it.  Just start with the RTF label and leave the RichTextBox open for editing during runtime.  Just as an FYI, VB6 captions support Unicode.  It's just an issue of getting VB6 strings into and out of them.  I've supplied easy procedures for this.  The other problem is that the PropertyBag doesn't appear to support Unicode (but it can be made to).  Also, the .FRM files are written in ANSI (which is strongly related to the PropertyBag), so we must make sure that our Unicode data goes into the .FRX file.  This is all easy though.  Just put the strings into a byte array in a variant and stuff this variant into the PropertyBag.  This does it, and it automatically gets saved in the .FRX file.  See the source code I've supplied for examples.  Regarding the actual property window, that does NOT support Unicode, so you have to design a custom property window using the RichTextBox (which does full Unicode).  I've done all of this in a very clean fashion in the supplied code.

----------


## devoas

Seems the link is down, can you please re-upload it

----------

