Page 1 of 2

Usig Ctrl+Y to delete a line

Posted: Mon Apr 06, 2009 4:55 pm
by sudip
Hi All,

Is it possible to delete a line in textbox or editbox using Ctrl+Y?

If possible, how to do it?

TIA.

With best regards.

Sudip

Re: Usig Ctrl+Y to delete a line

Posted: Mon Apr 06, 2009 5:45 pm
by esgici
Hi Sudip
sudip wrote: Is it possible to delete a line in textbox or editbox using Ctrl+Y?
Why you don't use Ctrl-Del ? ( after highlighted whole line ) ?

Ctrl-Y isn't very popular for line deleting.

Regards

--

Esgici

Re: Usig Ctrl+Y to delete a line

Posted: Tue Apr 07, 2009 3:59 am
by sudip
esgici wrote: Why you don't use Ctrl-Del ? ( after highlighted whole line ) ?

Ctrl-Y isn't very popular for line deleting.
Esgici
Yes Esgici. But, is there any way to do so (Ctrk+Y)? Our old Clipper/VFP users may require it ;)

With best regards.

Sudip

Re: Usig Ctrl+Y to delete a line

Posted: Tue Apr 07, 2009 12:01 pm
by Roberto Lopez
sudip wrote:
esgici wrote: Why you don't use Ctrl-Del ? ( after highlighted whole line ) ?

Ctrl-Y isn't very popular for line deleting.
Esgici
Yes Esgici. But, is there any way to do so (Ctrk+Y)? Our old Clipper/VFP users may require it ;)

With best regards.

Sudip
As far as I remember, CTRL+Y comes from DOS WordStar editor :)

It is possible, but with a a little work:

1. You must define the key combination and give it an action (ie: ON KEY CONTROL+Y OF ... ACTION ....

2. In the action procedure copy the content of the EditBox to a variable.

3. Scan the variable in a loop (for... mlcount() ... memoline() ... next) and remove the required line (you can detect it via caretpos property).

Regards,

Roberto.

Re: Usig Ctrl+Y to delete a line

Posted: Wed Apr 08, 2009 2:26 am
by esgici
Hi Sudip
sudip wrote:
Our old Clipper/VFP users may require it ;)
Perhaps your users are older than me ;)

Please take a look following example.

I had worked whole night on the way our Karta adviced.

But what I'm not sure this is a good way. F.e. line deleted by Ctrl+Y, can't undo by Ctrl-Z.

Code: Select all

#include "minigui.ch"

PROC Main()

    DEFINE WINDOW frmEBCYTest ;
        AT 0,0 ;
        WIDTH 640 HEIGHT 490 ;
        TITLE 'Harbour MiniGUI EditBox Demo ( Using Cntr-Y for line deleting )' ;
        MAIN 
        
        ON KEY CONTROL+Y ACTION EBoxDelL()

        @ 10,10 EDITBOX Edit_1 ;
            WIDTH 610 ;
            HEIGHT 440 ;
            VALUE  MEMOREAD( "EBox_CY.Prg" ) 
            
    END WINDOW // MAIN

    frmEBCYTest.Center()

    frmEBCYTest.Activate()

RETURN // Main()

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._

PROC EBoxDelL()                           // Line deleting in EditBox by pressing Ctrl+Del

   LOCA cEBoxContent := frmEBCYTest.Edit_1.Value  ,;
        nBegPntr     := frmEBCYTest.Edit_1.CaretPos,;
        nEndPntr     := frmEBCYTest.Edit_1.CaretPos

    WHILE nBegPntr > 0 .AND. SUBSTR( cEBoxContent, nBegPntr, 2 ) # CRLF
       --nBegPntr
    ENDDO
    
    nBegPntr += IF( nBegPntr < 1, 0, 1 )
    
    WHILE nEndPntr < LEN( cEBoxContent ) .AND. SUBSTR( cEBoxContent, nEndPntr, 2 ) # CRLF
       ++nEndPntr 
    ENDDO

    frmEBCYTest.Edit_1.Value := LEFT( cEBoxContent, nBegPntr  ) + SUBSTR( cEBoxContent, nEndPntr + 2 )      
    
    frmEBCYTest.Edit_1.CaretPos := nBegPntr + 1
   
RETU // EBoxDelL()

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
I hope that it will come in handy to you.

Regards

--

Esgici

Re: Usig Ctrl+Y to delete a line

Posted: Wed Apr 08, 2009 4:02 am
by sudip
Hello Roberto,

Thank you very much. I got another soln from elsewhere. But, this is the best :) (Both in coding and efficiency)


Hello Esgici:
Esgici wrote:Perhaps your users are older than me ;)

Please take a look following example.

I had worked whole night on the way our Karta adviced.

But what I'm not sure this is a good way. F.e. line deleted by Ctrl+Y, can't undo by Ctrl-Z.
First of all let me pay my gratitude regarding this program. :)
Excellent. It works like a breeze :) And I also understand the code :)
I don't think you are too old. :) (I know your age)
Age gives us more maturity and experience. In India, we believe aged persons are assets of our society. They can guide us to overcome various difficulties in our life. I believe "real age" lives in our mind.

With my best regards to you all.

Sudip

Re: Usig Ctrl+Y to delete a line

Posted: Wed Apr 08, 2009 11:58 am
by esgici
Hi Sudip

Thanks for nice words, especially about age :)

Please test it carefully before committing to users.

Regards

--

Esgici

Re: Usig Ctrl+Y to delete a line

Posted: Wed Apr 08, 2009 2:43 pm
by sudip
Hi Esgici,
Esgici wrote:Please test it carefully before committing to users.
Thanks a lot! Yes I shall do it!

There are sometimes when I feel depressed. All my positive thinking don't work for time being. Only one thing comes to rescue me - Faith. Faith in Myself, Faith in my Work, Faith in God. (Sorry, to write irrelevant words. But, I am now feeling very good!!!)

Thank you all.

With best regards.

Sudip

Re: Usig Ctrl+Y to delete a line

Posted: Wed Apr 08, 2009 2:57 pm
by esgici
sudip wrote: ...
Sorry, to write irrelevant words. ...
Hi Sudip

Please don't worry, your words doesn't irrelevant; personally I'm sure that I'am correctly understanding you and sharing your sens :)

Only a very little difference in detail: my faith list is in reverse order than yours.

Best Regards

--

Esgici

Re: Usig Ctrl+Y to delete a line

Posted: Wed Apr 08, 2009 3:03 pm
by sudip
esgici wrote:
sudip wrote: ...
Sorry, to write irrelevant words. ...
Hi Sudip

Please don't worry, your words doesn't irrelevant; personally I'm sure that I'am correctly understanding you and sharing your sens :)

Only a very little difference in detail: my faith list is in reverse order than yours.
Thanks a lot again. My wife is just sitting beside me (looking at what I am typing). And she is agree with your order :)
Regards.
Sudip