WPCubed Product Support

Inserting optional hyphen via code?

Hi,

Does anyone knows how can I insert optional hyphen via code?

Purpose of the optional hyphen (also know as: discretionary, soft) is to mark a possible hyphenation point, 'invisible' point at which a word can be broken.

Keyboard shortcut is Ctrl + '-' and works great.

How do I do it in code?

BR

#1 ♥ 0
4k Views 2 users read 1 min
support

Hi,

This is what the shortcut does:

189, VK_SUBTRACT: if Changing then // Hyphen
          if (wpUseHyphenation in FormatOptions) and (Shift = [ssCtrl]) then
          begin
            if not WPIsWordDelimiter(CPWideChar) then
            begin
              CPCharAttr := CPCharAttr xor cafsHyphen;
              if FMemo.Cursor.active_paragraph.Reformat > 0 then
                FMemo.ReformatAll;
              ChangeApplied;
              Memo.RePaint;
          // Memo.ShowCursor;
            end;
            Key := 0;
          end;
#2 ♥ 0

Line

CPCharAttr := CPCharAttr xor cafsHyphen;

that is, in my case

Editor->CPCharAttr = Editor->CPCharAttr ^ cafsHyphen;

did the trick!

Thanks a lot!

#3 ♥ 0
This category is archived. No new posts are possible.