Text Box with Transparent Background

Hello,

I'm a newbie to DesktopX, and really diggin' it! I'm making my first Widget, and have an issue. I am using the DesktopX Edit Control for a text box and would like a transparent background. Does this control support a transparent background? If not, can anyone suggest an ActiveX textbox control that does? I tried using a Layer object that is "Text" type and changing it's text using some OnKeyDown code, but I loose a lot of text box functionality doing this. Any suggestions?

Thanks!
6,468 views 19 replies
Reply #1 Top
No it doesn't allow a transparent background, and to my knowledge there isn't one that does.

I seem to recall however, that if you look in the sample objects there is a text object that functions like an Edit control which will probably do the job for you.
Reply #2 Top
Actually. I have scripted a textbox object in DX. It contains most the features the normal ones got. You can apply any bitmap DX support for the background, caret and selection.
http://thomthom.wincustomize.com/ViewSkin.aspx?SkinID=3947&LibID=3&comments=1
I expect there might be some issues in certain scenarioes, for instance, I haven't tried it against different odd charactert. But if you try it an find some issues just let me know.
Reply #3 Top
Wow - that's a lot of work thomassen! Good job! I was going that route and found a lot of odd behavior in the "key" value I get when using OnKeyPress... especially with keys like "[" and ";", etc.

I wrote a little widget that displays the "key" code as well as the codes for keys that have multiple characters (with shift key depressed) to help me with my other widget. Try it out and observe what you get when typing the keys I mentioned above. Is it just me, or is this odd? BTW, to use it, just click on it and press the key you want the code for...

Link

Thanks,
yeldnats
Reply #4 Top
Sorry - just read my post and realized I should explain this a liitle more. The white number that appears in the center of the widget is the ascii code passed to the OnKeyPress function in vbScript. Yellow numbers will appear above and below the white number for keys that can produce multiple characters - the top number is what would be expected for the shift+key press (I know the OnKeyPress won't support the key combinations), and the bottom number is what would be expected for the normal key press. The middle white number should match the bottom number, but it doesn't on certain keys. The "[" key sends 219, but I would expect 91.

(BTW, I made the numbers 3 digits to get them centered better.)
Reply #5 Top
Ok. I'll have a look into it over this weekend. I'll report back.
Reply #6 Top
hmm... is it really ASCII characteres returned? Or is it ANSI characters? Isn't there a difference there?
According the the Wscript docs, the Asc and Chr functions works with ANSI codes.

hmm.. searching info as I type here... http://www.robelle.com/library/smugbook/ansichar.html http://www.alanwood.net/demos/ansi.html

The thing is that I use a Norwegian keyboard here and the layout is slightly different. I have to use [Alt+Gr]+8 to get [, [Alt+Gr]+9 to get ], [Alt+Gr]+7 to get { and [Alt+Gr]+}. These don't work at all in my textbox object. I have to dig deeper to find out what's really going on with the codes beeing sent around here.
Reply #7 Top
I set up a couple of objects my self to see all the values beeing sent when I press a key. http://www.thomthom.net/xfiles/keyPeekaboo.dxpack

Right..., you get the euro sign by pressing [Alt Gr]+5 (at least I do with my norwegian keyboard layout), Object_OnChar returns key 8364. If you pass this value to the Chr function you'll get a runtime error. According to the list at http://www.alanwood.net/demos/ansi.html 8364 is the Unicode number for the euro character and the ANSI code is 128.

That means that there is something in the documentation that isn't right.
If an object has the focus then this function is called when a key is depressed and the ASCII
character code is returned in the variable.


I think DX got Unicode support some versions ago and this might have something about it?
Reply #8 Top
Forgot to explain how the object worked: you set focus to the ONKEYDOWN text object and start pressing keys.


btw, I've found a couple of serious bugs in my textbox object. I'll be working on that.
Reply #9 Top
I think you are on to something - maybe DXscript has a particular keyboard layout in mind? I'm using English US, so I don't have a "Û" (character 219 on the ANSI character chart (thanks for the link))... maybe there is a keyboard layout that has the "Û" character in the position where I have the "[" character? Seems wierd though, even in unicode I should still get 91 (or at leat 0x5B)for "[".

I could not get your new object to work for me... btw, I like the name, LOL! It would be interesting to type characters we both have in common on our keyboards and see if we get the same "key" value from DXscript widgets... I'll make a diagram of my keyboard and "key" values I'm getting and post it.
Reply #11 Top
My keys are http://www.microsoft.com/globaldev/keyboards/kbdno.htm
(Note: I couldn't get that site to work in Firefox, had to use IE. The other keys not included in that layout are the same as the english one.)

Note that the keys next to the Backspace and Enter button are used to create letters like àáä. Because we got three extra vowels (æ ø å) they keys are shiftet around a bit, so I think we have to use the Alt Gr button more.

As you said, we should really get the same code returned, at least for the OnChar() function. I'm wondering if the problems we have is that the functions and key values we use uses different character systems (ANSI, ASCII, Unicode)

I'm doing debugging on my text object at the moment. I'll report back.

(btw, what wasn't working with my object? Not sure what object to activate? try clicking each of them end pressing some keys. and make sure scripts are enabled.)
Reply #12 Top
Ah, just noticed you had put in the returned key values there. I'll get on with that.
Reply #13 Top
I've mapped the graphic you gave me. The changes are made in red and green.
Green values are key values returned by OnChar. Values in square brackets are values returned when Shift is pressed, and curly brackets for AltGr.
Red values are the results from KeyDown/KeyUp key values.

Reply #14 Top
Hmmm... some KeyDown keys match, some do not. Although some of the keys aren't completely identical, it's still odd - like your "219" value was from " ` / " and my "219" value is from " { [ "... I don't get it

Well, the biggest thing I've learned from this is that I should use OnChar function like you did in your text box object and not OnKeyDown/Up functions like I was trying. The OnChar values are correct and match.

I found this VBScript function, but haven't looked into it yet... Link
Reply #15 Top
BTW, I got your object to work... I'm such a Newb... I didn't realize that I could just change the .zip to .dxpack and load it!
Reply #16 Top
Actually, the KeyDown and KeyUp doesn't return the character code, it returns the code for the key it self.

I managed to make my textbox accept the Euro sign. There is two additional variants of the Chr function, ChrB and ChrW. ChrW accepts Unicode values, and everything worked like a charm when I used that.

I've fixed the bugs (that I am aware of) with my Textbox object and are uploading it. Should be updated in a couple of days after it's been accepted.
Reply #17 Top
I didn't realize that I could just change the .zip to .dxpack and load it!


It was in zip format??
Reply #18 Top
ChrW accepts Unicode values, and everything worked like a charm when I used that.

Great!

It was in zip format??

Yes, if I right click and use "Save Target As" (Internet Explorer), it comes up as "keyPeekaboo.zip" - but if I check the properties of the link, it is "keyPeekaboo.dxpack"... IE is weird, I need to make the switch to Firefox. Last time I checked, Firefox did not support VBScript, though - has this changed?

Anyway, thanks for your help on this thomassen! I look forward to your textbox upload.
Reply #19 Top
The textbox has been accepted and is availible. Let me know if you should find more issues.

Not sure if Firefox support VBScript. Haven't tried it. But for websited I use JavaScrip because I think it's suported on more platforms thatn VBScript.