Adding Text to Field - Is there a quicker way?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Adding Text to Field - Is there a quicker way?
Does anyone find it strange that you can't type directly into a field to create a label? We must select the field, open the property inspector, click on the "contents" section, click in the contents box, and then type. It seems weird to bury such a common action. The tooltip is on the front page, but not the actual contents? Is there a keystroke command to get to the contents page quickly?
Mark P.
Mark P.
With the mouse pointer over the lable, type ctrl+M to bring up the message box. In the MB type 'set the text of the mousecontrol to "new label text" '.
This might sound like an unnecessarily complex workaround, but the principal behind it can be generalized to change the properties of many objects without opening the inspector and finding the relevant section.
It's important to bear in mind that (practically) the whole Rev IDE is dynamic and under your control. Of course, it is only easy to do things like I suggest above if you find typing easy, and if you know the names of the properties.
I do believe that GLX2 provide a free tool called 'no click inspector' which might offer you some benefit (http://glx2.com/video/2053167:Video:8150 ). Warning: that page plays music/video once you load it. I tried to find a link to the no-click property inspector on that site, but I couldn't, so I can't really tell you what it does. (I hate the design of that site so much).
This might sound like an unnecessarily complex workaround, but the principal behind it can be generalized to change the properties of many objects without opening the inspector and finding the relevant section.
It's important to bear in mind that (practically) the whole Rev IDE is dynamic and under your control. Of course, it is only easy to do things like I suggest above if you find typing easy, and if you know the names of the properties.
I do believe that GLX2 provide a free tool called 'no click inspector' which might offer you some benefit (http://glx2.com/video/2053167:Video:8150 ). Warning: that page plays music/video once you load it. I tried to find a link to the no-click property inspector on that site, but I couldn't, so I can't really tell you what it does. (I hate the design of that site so much).
Thanks Bernard. At first, when I read this I thought, "Indeed this DOES sound like an unnecessarily complex workaround."
But, I gave it a shot, and with a bunch of fields, it does tend to be faster (although it's an odd feeling for me to place my mouse over an object *without* clicking anything). I haven't had the courage yet to mess with the IDE, but in pseudo code it might be something like this?
OR
But where would I put this script? Wouldn't this have to be a parent script for every single field. I guess that could be dynamically set too. Hmmm....
Mark P.

Code: Select all
on mouseDoubleUp
open the property inspector of me
set the property inspector page of me to contents
focus on the contents' textbox
end mouseDoubleUp
Code: Select all
on mouseDoubleUp
answer ""
put it into the field of me
end mouseDoubleUp
Mark P.
acidjazz,
you probably want to change the content of the label field when developing, not later. So instead of hacking the IDE, why don't you put temporarily something like:into the script of the stack? You could even ask for a name for this field. You just create a bunch of label fields and then you set their content and if you wish their name. Afterwards you delete this handler.
Or even more generic: you put this handler into a separate stack with this script and when developing you 'start using' that stack (which this developer helper stack of yours initiates when it is opened) In short a library. That way you dont modify the IDE and still have your extra tools for developing.
And I agree, I also find the inspector has a lot of room for improvements. I used to use the GLX2 property inspector which is a easier to navigate, but lately I did used gradients a lot and that he doesnt understand.
regards
Bernd
you probably want to change the content of the label field when developing, not later. So instead of hacking the IDE, why don't you put temporarily something like:
Code: Select all
on mouseUp
put the target into myTarget
if not (the name of myTarget contains "label field") then exit mouseUp
ask "what should the content of me be"
if it is empty then exit mouseUp
set the text of the target to it
end mouseUp
Or even more generic: you put this handler into a separate stack with this script and when developing you 'start using' that stack (which this developer helper stack of yours initiates when it is opened) In short a library. That way you dont modify the IDE and still have your extra tools for developing.
And I agree, I also find the inspector has a lot of room for improvements. I used to use the GLX2 property inspector which is a easier to navigate, but lately I did used gradients a lot and that he doesnt understand.
regards
Bernd
I think Bernd has the right approach, but if you really want to look at delving into the IDE, then in the Toolsets folder you will find the revtools.rev stack. If you open that and edit the script of the first card, you will find a handler "revCreateObject" in which you will find the default settings for all the controls that you may drag onto a card from the tools palette. You could change the default names for instance, or add other properties. eg in the case "label" part of the switch statement you could add a line which will add a type property into a new custom property set cProperties (so as not to get mixed up with regular custom props)which you could then interrogate to determine more specifically that it's a custom Label that you want to be able to do things with as suggested by Bernd. If you wanted to be more sophisticated you could instead create objects with default behaviors by adding the lines in the revCreateObject handler, as long as you can tie the behaviors to a fixed parent id.
Needless to say, this will not be supported by RunRev, and you must back up your system before you try anything out like this.
Code: Select all
set the cProperties["type"] of the templateField to "label"
Needless to say, this will not be supported by RunRev, and you must back up your system before you try anything out like this.
I have made a library because exactly this also enervates me to no end:
How to use:
How to use:
- You make a stack named "labelEditor" containing the first script.
- Now name the (first and only) card of the stack "labeleditor"
- Then create a custom property called "templateScript" for that stack, and set it to the second script.
- Now you save the stack to the plugin directory (it's where the Rev IDE is installed to).
- Finally you go to the menu: "Development" -> "Plugins" -> "Plugin Settings", and make the stack you just saved start invisible,when the IDE starts. (Choose "Revolution starts up" and "Invisible").
Code: Select all
--this first script goes into the script of the stack
on openstack
if the target = "card" && quote & "labeleditor" & quote then
start using me
end if
pass openstack
end openstack
on mousedoubleUp
if the name of the target = "field" && quote & "Label Field" & quote then
clone the target
set the script of it to the templateScript of me
set the boss of it to the id of the target
set the locktext of it to false
set the traversalon of it to true
set the loc of it to the loc of the target
set the showborder of it to true
set the autohilite of it to true
set the opaque of it to true
select the text of it
else
pass mousedoubleUp
end if
end mousedoubleUp
on docleanup theID
delete field ID theID
end docleanup
Code: Select all
--this second script goes into the custom property "templateScript" of the stack
on closeField
finished
end closeField
on exitField
finished
end exitField
on returnInField
finished
end returnInField
on enterInField
finished
end enterInField
on finished
put the text of me into field id (the boss of me)
send "doCleanup" && the id of me to this stack in 0 seconds
end finished
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Bjornke- nicely done. The only problem I see with it is that I usually rename my label fields to something like "lblFirstName" to match the "fldFirstName" text entry field. And since label fields are just text fields with certain configurations set, it's hard to differentiate between them otherwise than using the "Label Field" name. Maybe just checking to see if the text is locked would be a better test than using the name...
Snap Mark, that's exactly my policy too. (And that's why I mentioned editing the revtool.rev stack to add a custom property to the label fields by default, so that you could test for this property to see if it was definitely a label as opposed to any other field type. As it happens I also set the default name of a label field to "lbl" and a regular field to "fld" so that it was simple just to add the name after the prefix, so in theory I could just check whether the name of the field begins with "lbl" but... you know...)mwieder wrote:Bjornke- nicely done. The only problem I see with it is that I usually rename my label fields to something like "lblFirstName" to match the "fldFirstName" text entry field. And since label fields are just text fields with certain configurations set, it's hard to differentiate between them otherwise than using the "Label Field" name. Maybe just checking to see if the text is locked would be a better test than using the name...
Well, having been through the revTools code before, it's a bit of a jungle. What I'd do in that case is find the section that creates a new label field object and insert code that adds a custom property to the templateField before the new field gets created. That way you could check the custom property of a field in a frontscript handler and act accordingly. The downside is that you'd have to do this for each new rev release, which is a bit of a pita. It's probably not worth the effort just for this.
Wow! Quite a conversation. This is great. The revTools stack certainly is a jungle. Fascinating to read the programmers comments about bugs though! I felt like a spy. And then, just as SparkOut warned, I corrupted the file (but had made a backup, so it's okay). It would be useful to know what I did that messed it up. I was using Notepad++ (a code text editor) to make very tiny changes. In revTools.rev there is rev-like code at the top, and then the same code in html at the bottom. I was delicately messing with the html when bad things happened. the IDE would hang when opening up.The reason I was using the text editor is because it seemed to be confusing the IDE to be trying to edit the tools palette. It kept saying "You already have this open." Even when I tried to change the name to revTools1.rev, it still seemed upset.
Anyway, now I'm playing around with Bjornke's plug-in. Very nice. Yes, it would be great if some sort of keystroke combination would allow you to go from browse to edit mode. I've got a 24" monitor at the highest resolution, so I probably sound lazy, but that tools palette sometimes seems awfully far away! And in any case, it's still cool, I'm learning quite a bit, and appreciate all the helpful comments!
Mark
Anyway, now I'm playing around with Bjornke's plug-in. Very nice. Yes, it would be great if some sort of keystroke combination would allow you to go from browse to edit mode. I've got a 24" monitor at the highest resolution, so I probably sound lazy, but that tools palette sometimes seems awfully far away! And in any case, it's still cool, I'm learning quite a bit, and appreciate all the helpful comments!
Mark
Mark- We talking about the same revTools.rev? (I also use NotePad++, but not for editing rev scripts). There's no html code in my copy of the scripts. If you do feel inclined to play around with this, look in the revCreateObject handler in the card script. There's a big switch statement in there and one of the switch cases is "label". That's the one you'd want to modify.
...and as a side note, if you have glx2 installed one of the free options (whether or not you have a license to use the script editor) is the ability to switch between browse and edit mode with control-tab.
...and as a side note, if you have glx2 installed one of the free options (whether or not you have a license to use the script editor) is the ability to switch between browse and edit mode with control-tab.