Next, open the properties of the “parent” object. Create a new script. Copy and paste this script into the “parent” object.
' This script goes in the parent object of the shortcuts
'--Add more cases for more shortcuts
'--Change maxW variable to your maximum allowed width
'Called when L-click on object or its children
Function Object_OnLButtonUpEx(obj, x, y, dragged)
If dragged Then Exit Function
Select Case obj.name
Case "shortcut1" '---replace with the name of shortcut
'Add more cases for more shortcuts
'Case "another shortcut"
'--- Input Box ---
Input = InputBox("Enter Text", "Change Shortcut Text",DesktopX.Object(obj).tooltiptext)
If strCheck(Input) = "t" Then
DesktopX.Object(obj).text = Input
DesktopX.Object(obj).tooltiptext = Input
'--Check if input is not blank (or spaces) ---
Dim abet, nums
abet = "abcdefghijklmnopqrstuvwxyz"
nums = "0123456789"
chk = "f"
strg2 = LCase(strg)
For x = 1 To len(abet)
g = Mid(abet,x,1)
If Instr(strg2,g) > 0 Then chk = "t"
If chk = "f" Then
For y = 1 To len(nums)
If Instr(strg2,g) > 0 Then chk = "t"
strCheck = chk
'--- Truncate Text to a minimum length--
maxW = 200 '--change the value to max allowed width
If DesktopX.Object(obj).width > maxW Then
While DesktopX.Object(obj).width > maxW
DesktopX.Object(obj).text = Mid(desktopX.Object(obj).text,1,len(DesktopX.Object(obj).text) - 4) & "..."
The script works in four parts:
-OnLButtonUpEx, we check which shortcut has been clicked and then open the input box. (This could just as well be OnRButtonUpEx, by the way.)
-Function iBox, we display the input box, get user input, and call the other function to check if the input contains actual text. If everything checks out, it sets the new tooltip, text, and calls the function to truncate the object.
-Function strCheck, we check the user’s input for letters or numbers. If none are found, the input is blank and is not accepted.
-Function truncateTxt, we run a loop that continuously shortens the length of the text until it reaches the maximum allowed width. Then, we add ellipses to show there is more text than what appears.
That’s all there is to it. Enjoy!
DX Scripting - DesktopX User's Guide
VBScript Functions - W3Schools.com
Goings-on in the Community
Over the last month, I’ve seen more people checking out RomanDA’s step-by-step tutorials. I’ve seen more posts asking for help in figuring out one DX issue or the other. I’ve seen more activity in the DX themes gallery. I’ve seen more activity in the DX object gallery. And I’ve gotten a noticeable amount of emails/PMs asking for specific DX help.
I could very well be imagining things, but, is DesktopX making a comeback? I’ve always believed that DesktopX has great potential waiting to be transformed into kinetic creativity.
Case in point:
This is OCCAM, a WIP DesktopX theme by PoSmedley. You may have read his post about it here.
It's a brilliant concept and I think it’ll be a smash hit once completed. It’s been interesting to read Po's progress on the theme as well.
It’s this kind of visible activity that sparks interest about the program, feeds creativity, fuels excitement, and cultivates can-do-too-ness. I’d like to see more of it.
So, if you’ve got a DX work in progress, or even a concept in progress, tell us about it below. (Don't leave me hangin' people!)
Huh? What? What have I been up to?
Well, I’ve spent the entire last month collaborating on a gadget with a friend for a gaming website. We’ve disagreed, agreed, butt heads, put our heads together, and the thing is almost ready for beta testing (I wonder if there are any Street Fighter Online players on WC.)
I’m pretty much a loner when it comes to creating widgets/gadgets so this was a new experience for me. He really helped push me to strive for excellence. Sure, I’d wince, groan, dread the amount of time and coding it would take, and pull my hair out over stupid errors, but when all was said and done I’d be pretty darn proud of what we accomplished. I’ve learned a lot and I’ve improved a lot. Such is the joy of DXing!
So, fellow DXers, what’ve you been up to? Share your pics or concepts below.
Huh? What? Where’s my pic? Okay, here: LINK
Thanks for reading! See you next month.