Alpha Video Training
Results 1 to 7 of 7

Thread: <TEXT>.delete()

  1. #1
    Member Ton Spies's Avatar
    Real Name
    Ton Spies
    Join Date
    Apr 2002
    Location
    Leeuwarden, The Netherlands
    Posts
    555

    Default <TEXT>.delete()

    Try to understand more Xdialogdetails

    Can some one tell me this exemple is complete?
    It looks like missing a lot of lines after line 4
    and the line here presented as line 5 must be something like line 30 or 50
    Anyway the Interactive window does not act.


    Who can help with other documentation than AlphaFiveHelpV9 and/or can explain this function??

    Thanks

    Ton


    <TEXT>.DELETE()
    Syntax
    VariableName.OBJECT.DELETE()
    Description
    The OBJECT.DELETE() method is used with an Xdialog text control. It cuts the currently selected text from the contents of the VariableName text variable.

    Supported By

    Alpha Five Version 6 and Above

    Limitations

    Desktop applications only.

    Examples

    dim ptext as P
    dim ptext.text as C
    dim ptext.object as P
    dim ip as N
    if (a_dlg_button = "delete") then
    a_dlg_button = ""
    ip = ptext.object.get_cursor()
    ptext.object.delete()
    'after clicking the 'cut' button focus is on the button. we want to return focus to the edit control
    ui_dlg_ctl_goto(dlg_title,"ptext")
    if (ip <=len(ptext.text)) then
    ptext.object.set_cursor(ip)
    else
    ptext.object.set_cursor(len(ptext.text))
    end if
    a_dlg_button = ""
    'this causes the text box to scroll if the insertion point is not currently visible
    ptext.object.show_caret()
    end if

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: <TEXT>.delete()

    I believe the example shown is suitable to include in the code section of your own xdialog.

    ,<<%code%

    'example goes here

    %code%)
    There can be only one.

  3. #3
    Member Ton Spies's Avatar
    Real Name
    Ton Spies
    Join Date
    Apr 2002
    Location
    Leeuwarden, The Netherlands
    Posts
    555

    Default Re: <TEXT>.delete()

    Well, anyway to me it does not clear. It only makes it unaccessable.

    Meanwhile I've seen that all the Xdialog Text Control Methods have that unusable examples, and I cannot find it on other places in the V9-documentation.

    Someone has better documentation of these methods in previous versions?

    Ton

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default Re: <TEXT>.delete()

    Ton, I share your confusion. The following example does nothing when the "cut" button is pressed after I select part of the text string with my mouse.

    Code:
    'Create an XDialog dialog box to prompt for parameters.
    DIM SHARED vMyText as p
    DIM SHARED vMyText.text as C = "Tom Cone Jr"
    Dim SHARED vMyText.object as P
    DIM ip as N
    
    DIM SHARED varC_result as C
    ok_button_label = "Cut"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Example",<<%dlg%
    {region}
    | [.40vMyText];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!Cut> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%Code%
    'msgbox("",a_dlg_button)
    if (a_dlg_button = "Cut") then
    	a_dlg_button = ""
    	ip = vMyText.object.get_cursor()
    	vMyText.object.delete()
    	msgbox("",vMyText.text)
    	'after clicking the 'cut' button focus is on the button. we want to return focus to the edit control
    	ui_dlg_ctl_goto("Example","vMyText")
    	if (ip <=len(vMyText.text)) then
    		vMyText.object.set_cursor(ip)
    	else
    		vMyText.object.set_cursor(len(vMyText.text))
    		a_dlg_button = ""
    	end if
    end if	
    
    if a_dlg_button = "CANCEL" then
        'close dialog 
    end if
    
    %CODE%)

  5. #5
    Member Ton Spies's Avatar
    Real Name
    Ton Spies
    Join Date
    Apr 2002
    Location
    Leeuwarden, The Netherlands
    Posts
    555

    Default Re: <TEXT>.delete()

    Hi Tom,

    Thank you for making a completed XDialog.
    Have you ever used these text methods in XDialog?

    With your example I 've seen that the cursorposition can be retrieved and when the text gets focus again, you can set the cursor (again) to that position.

    I feel that these text methods can be usefull for me but I don't know yet for sure.
    Therefore these text controle methods trigger me but the lack of (up to date) documentation...... is another thread .......but prevent me to get it clear as results are indeed confusing and that is unfortunately disappointing.

    I have not seen another place where this was attended, have you?

  6. #6
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default Re: <TEXT>.delete()

    Ton, I've only recently needed to position the cursor in a situation where my code was returning focus to a text control. When focus arrived at the text control the entire text was "selected". Moving the insertion pointer to the end of the text string (with the script) was a better choice than asking the user to lift hands from keyboard to grab mouse and reposition the insertion pointer manually.

  7. #7
    Member Ton Spies's Avatar
    Real Name
    Ton Spies
    Join Date
    Apr 2002
    Location
    Leeuwarden, The Netherlands
    Posts
    555

    Default Re: <TEXT>.delete()

    For an interested case I investigated the script 'pointer_arry2' in the Learning XDialog database.

    I have noticed that when a user wants to change the rownumber and first of all uses the backspace to clean the current rownumber there is an error at the moment that this rownumber reaches <1.
    That error does not recover at the moment the rownumber gets a value >0.
    That means that we have to prevent also the use navigating before the end.
    It would we nice if Alpha Software had presented a solution but they do not know about this failure.

    Now we also have to prevent the user to use the backspace of delete key (untill the value is only one digit) by transforming these (next) hits in selecting the current value. This indicates that the user can overwrite the value.
    (or make another work around which achieves the same).

    This must be a basic step and knowledge about text controle methods can be very usefull.
    Tying to accomplish that I struggled with the documentation about the functionality of the text controle methods. Maybe also because I have to translate it for myself into dutch before I can understand it.
    So I don't get this solved.


    Original details:
    look at the lines starting at linenumber 54

    Code:
    if a_dlg_button = "i_changed " then 
    	
    	'prevent the user from navigating past the end
    	a_dlg_button = ""
    		if  i > rec.first_empty("lastname") - 1	then 
    			i = rec.first_empty("lastname") - 1
    			
    		end if
    end if
    ------------------------------------------------------------
    Code:
    if a_dlg_button = "i_changed " then 
    	a_dlg_button = ""
    	
    		'prevent the user from navigating past the end
    			if  i > rec.first_empty("lastname") - 1	then 
    			i = rec.first_empty("lastname") - 1
    		else if i<1
    			i=1
    		        'prevent the user from navigating before the begin.
    		        pseudocode: do not accept backspace or delet-key 
                            but select (and give focus to) the current value
    		end if
    end if

    Any help is welcome

    Ton
    Last edited by Ton Spies; 07-29-2009 at 09:28 AM.

Similar Threads

  1. xbasic delete code running before delete
    By Ronald Anusiewicz in forum Alpha Five Version 8
    Replies: 6
    Last Post: 06-20-2009, 06:40 PM
  2. replace text in rich text memo field in all table records
    By marcuswolfe in forum Alpha Five Version 9 - Desktop Applications
    Replies: 3
    Last Post: 03-08-2009, 11:34 AM
  3. Cannot Copy Text from Rich Text Memo Field
    By rtbtat in forum Alpha Five Version 7
    Replies: 8
    Last Post: 10-11-2006, 09:37 AM
  4. Display Record Based on TEXT typed in Text Box
    By Neomagnus in forum Alpha Five Version 7
    Replies: 10
    Last Post: 11-21-2005, 09:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •