Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memo editbox, 'Properties' disabled in the menu

Status
Not open for further replies.

dantheinfoman

Programmer
May 5, 2015
131
US
Hi All,

In reference to the code I got from thread184-823135, I've been using this for a custom form for editing memo fields. It's great, it allows copy, paste, undo, redo - using keyboard shortcuts. However, the users are complaining that they can no longer auto-tab, meaning when they tab and hit Enter it just starts over to the far left, instead of indenting where the last line is.

The 'Properties" portion of this code is grayed out when I use this form. Any thoughts? Here's my code for the menu options:
Code:
DEFINE POPUP _medit MARGIN RELATIVE SHADOW
DEFINE PAD _msm_edit OF _MSYSMENU PROMPT "\<Edit" KEY ALT+E, "" MESSAGE "Edits text or current selection"
ON PAD _msm_edit OF _MSYSMENU ACTIVATE POPUP _medit
DEFINE BAR _med_undo  OF _medit PROMPT "\<Undo"       KEY CTRL+Z, "Ctrl+Z"  MESSAGE "Undoes the last command or action"
DEFINE BAR _med_redo  OF _medit PROMPT "Re\<do"       KEY CTRL+Y, "Ctrl+Y"  MESSAGE "Repeats the last command or action"
DEFINE BAR _med_sp100 OF _medit PROMPT "\-"       
DEFINE BAR _med_cut   OF _medit PROMPT "Cu\<t"        KEY CTRL+X, "Ctrl+X"  MESSAGE "Removes the selection and places it onto the Clipboard"
DEFINE BAR _med_copy  OF _medit PROMPT "\<Copy"       KEY CTRL+C, "Ctrl+C"  MESSAGE "Copies the selection onto the Clipboard"
DEFINE BAR _med_paste OF _medit PROMPT "\<Paste"      KEY CTRL+V, "Ctrl+V"  MESSAGE "Pastes the contents of the Clipboard"
DEFINE BAR _med_clear OF _medit PROMPT "Cle\<ar"                            MESSAGE "Removes the selection and does not place it onto the Clipboard"
DEFINE BAR _med_sp200 OF _medit PROMPT "\-"
DEFINE BAR _med_slcta OF _medit PROMPT "Se\<lect All" KEY CTRL+A, "Ctrl+A"  MESSAGE "Selects all text or items in the current window"
DEFINE BAR _med_sp300 OF _medit PROMPT "\-"
DEFINE BAR _med_find  OF _medit PROMPT "\<Find..."    KEY CTRL+F, "Ctrl+F"  MESSAGE "Searches for specified text"
DEFINE BAR _med_finda OF _medit PROMPT "Find A\<gain" KEY CTRL+G, "Ctrl+G"  MESSAGE "Repeats the last search"
DEFINE BAR _med_repl  OF _medit PROMPT "R\<eplace..." KEY CTRL+L, "Ctrl+L"  MESSAGE "Replaces specified text with different text"
DEFINE BAR _med_sp400 OF _medit PROMPT "\-"
DEFINE BAR _med_pref  OF _medit PROMPT "Prope\<rties..."                    MESSAGE "Set editor properties"

Thanks for any thoughts on this,
Dan
 
Dan, I'm not sure what you mean by "auto tab", but if you mean you want to let the user tab out of the edit box and into the next control, then you should look at the edit box's AllowTabs property.

If that's not what you meant, my apologies.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

Sorry, to clarify, they want to indent and when they press Return, for it to keep that degree of indention until they decide to shift-tab or backspace at whatever line they want. Normally (with the old memo edit) they could press Tab as much as they wanted and it would indent several times in. This used to be an option in memo properties when they right click. Now properties is in the menu at the top of the screen under "Edit", but Properties is always grayed out.

I tried making this form modal, but Properties is still grayed out.

The properties comes from the bottom part of the code I posted,
Code:
DEFINE BAR _med_pref  OF _medit PROMPT "Prope\<rties..."                    MESSAGE "Set editor properties"

Thanks

Dan
 
Ah, I see. Maybe it should be called auto-indent rather than auto-tab.

So the crux of the question is why the Properties command is greyed out on the Edit menu. I would have guessed that the properties dialogue is not available if you call the Edit menu from within an executable (as opposed to from within the VFP development environment). But that seems to be contradicted by the fact that you can call it from the context menu.

Still, it might be worth checking. So are you running the app as an EXE? And, if so, does the problem still occur if you run it in the development environment?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I'd say the Editor Properties are about the code editor of the IDE, options such as Syntax coloring are not easily transferred to a memo and if at all, in a memo popup window, not in an editbox control. That's actually a separate topic, Doug Hennig has written about.

That part of the properties at least is a hint those settings don't work with editboxes.

The option you want from that Edit Properties dialog is literally called "Automatic indent", but it's not available at runtime. The VFP Editor is not available at runtime, it's an IDE component.

The editbox Allowtabs property does allow tabs to indent in editboxes instead of moving focus to the next control, but it's not auto indenting. There is no simple solution, I'd say, because if the editbox automatically wraps the typed text, the users would also expect the wrapped text to have the same indentation as the previous line, which is only possible, if you'd be able to detect that wrapping (there is no event firing for it) and then insert a CRLF plus some tabs.

I'd say you have to live with the editbox limitations or use something more complex, eg an rtf text control. That indeed would allow some features you didn't have yet neither in editboxes nor memo edit windows. In the form of more formatting and coloring options. I'm unsure, whether it's supporting automatic indent, but it'll offer many other desirable things for better text editing.

Bye, Olaf.
 
Actually, I don't think auto-indent would work even with an RTF control - at least, not if wordwrap is enabled (for the reasons you mentioned, Olaf). On the other hand, it would be possible to set paragraph properties in RTF, so you could specify a left indent, and each paragraph would respect that, until you unset it or changed it to something else.

That said, going from a native edit box to an RTF control is a big jump in complexity, and might not be worth the effort.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Dan,
I am not so sure, but by default if one hits the TAB key in an Editbox, Fox would jump to the next field in your sequence order and not indent as you mentioned.
It is however possible to have this done but for that, according to me, you shall have to make use of the HTMEdit class. This class also has an indent and unindent option, not by using the TAB key but by using the according button just like you have in e.g. MS Word and other TextEditors.
HTMLEdit class can be found at Try it and if ness I could translate it for you from French into English.
Regards,
Jockey(2)
 
Mais oui!
Looks very promising, Jockey2! (Thanks Mike and Olaf as well!!)

Can the HTMEdit be used for editing a memo field? If so, i'll see if I can combine this with my keyboard shortcuts, unless this is already on it. I have to make a scheduled call, but will play with this more very soon.

Thanks

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top