Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: actions for TextEdit  (Read 13179 times)
.
Posts: 8


« on: April 10, 2008, 01:46:56 pm »

we want to add some functionality to our "texteditor" and so we need some action during the usage of TextEdit:

1. if the user activates a part of the text and calls an ON ACTION "bold" we need the information of the first and last activated character (perhaps a new Dialog.getPosActiveFirst("textedit")  Dialog.getPosActiveLast("textedit"). There are  a lot of more function we could use these new methods

2. after/beforre inserting/deleting parts of the text some new actions (before_insert_textedit, after_insert_textedit, before_delete_textedit, after_delete_textedit) should be thrown. there we can save with the help of the new methods the text to make multiple redo possible
Bernard M.
Four Js
Posts: 45


« Reply #1 on: April 16, 2008, 10:10:33 am »

1. You can achieve this by getting the values of the 'cursor' and 'cursor2' attributes of the TextEdit form field:
     
Code
  1.    ON ACTION bold
  2.  
  3.      LET r = ui.Interface.getRootNode()
  4.      LET nl = r.selectByPath("//TextEdit")
  5.  
  6.      LET n = nl.item(i)
  7.  
  8.      LET p = n.getParent()
  9.      LET cur = p.getAttribute("cursor")
  10.      LET cur2 = p.getAttribute("cursor2")
  11.  

Attached is a basic application which shows this.


2. What you ask is that before inserting "parts of the text" an action should be executed. The same after inserting. And the same for deleting... But what do you mean exactly by "parts"? Should this be done for every character typed in the TextEdit? If not, how to determine when a "part" begins and when a "part" ends?
And what would this mean as network traffic between the front end and the DVM if an action is thrown before/after every insert/delete?
I can create a new feature request for this, but you need to clearly describe your needs.

* test.tgz (0.6 KB - downloaded 1246 times.)
Reuben B.
Four Js
Posts: 1113


« Reply #2 on: April 16, 2008, 11:59:43 am »

For part 2 of the question, 2.10 introduced ON ACTION dialogtouched , see https://4js.com/online_documentation/fjs-fgl-2.10.01-manual-html/User/InteractionModel.html#DIRTY

thus something like...

Code
  1.      ON ACTION dialogtouched
  2.         LET stack_ptr = stack_ptr + 1
  3.         LET stack[stack_ptr] = FGL_DIALOG_GETBUFFER()
  4.      ON ACTION undo
  5.         IF stack_ptr > 1 THEN
  6.            LET stack_ptr = stack_ptr - 1
  7.            CALL FGL_DIALOG_SETBUFFER(stack[stack_ptr])
  8.         END IF
  9.      ON ACTION redo
  10.         IF stack_ptr < stack.getLength() THEN
  11.            LET stack_ptr = stack_ptr + 1
  12.            CALL FGL_DIALOG_SETBUFFER(stack[stack_ptr])
  13.         END IF

...is possible. 

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
.
Posts: 8


« Reply #3 on: April 16, 2008, 12:56:16 pm »

thanks a lot for your help

Ralph
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines