среда, 10 октября 2012 г.

Few questions were not clear for me, so I asked Fardad to clarify, maybe for somebody it will be usefull.
1)The user terminates editing by pressing ENTER, TAB, ESCAPE, UP, DOWN, PGUP, PGDN
How do I terminate it? by using system("pause"); ? and if user presses for example ENTER again he can continue typing?

2) If the user presses ESCAPE, your function aborts editing.
Does it mean that I am just returning string and cursor to it's original state?


Answers:

1) Termination happens but breaking the interface loop and returning the last key hit by user (int key).

2)
a) yes, you must do this by allocating memory to the size of the incoming string before editing begins and copying the content of str in it. Also you must create local variables holding the values of *strOffset and *curpos.
b) then make sure right before returning key at the end, you delete the allocated memory.
c) when  Escape is hit restore the value of str by copying back the data from allocated memory into str and setting the values of *strOffset and *curpos to their original values.

Комментариев нет:

Отправить комментарий