I just need the technique what I am missing in this example.
When you run this code and you empty the rownumber using the backspace you indirectly have chosen rownumber zero/null.
The result is shown at right part of the Xdialog and this will not recover even we add a valid number. So we have to prevent the value from <1.
The easest way is to insert after line 61:
But..
If you now try to see row 22 and you will go to 7 and back again to 20, you see it's not an elegant way to get there. Or you are an experienced user.
It would be nice if the code at some moment would highlight or select the current rownumber to idicate the user to stop deleting of backspacing and just insert a value.
Who can help me with inserting a few tricky lines of code?
Thanks
Ton
Source: This is the second script of lesson 11 of 'Learning Xdialog' that handles about 'Displaying Data from a Table' and is called 'pointer_array2'.
When you run this code and you empty the rownumber using the backspace you indirectly have chosen rownumber zero/null.
The result is shown at right part of the Xdialog and this will not recover even we add a valid number. So we have to prevent the value from <1.
The easest way is to insert after line 61:
Code:
if i <1 i=1 end if
If you now try to see row 22 and you will go to 7 and back again to 20, you see it's not an elegant way to get there. Or you are an experienced user.
It would be nice if the code at some moment would highlight or select the current rownumber to idicate the user to stop deleting of backspacing and just insert a value.
Who can help me with inserting a few tricky lines of code?
Thanks
Ton
Source: This is the second script of lesson 11 of 'Learning Xdialog' that handles about 'Displaying Data from a Table' and is called 'pointer_array2'.
Code:
'Date Created: 12-Jun-2002 09:07:49 PM 'Last Updated: 15-May-2003 03:28:32 PM 'Created By : 'Updated By : table_name = a5.Get_Path()+chr(92)+"clients.dbf" dim rec[1000] as p rec.initialize_from_table(table_name,".t.","lastname") dim i as n i = 1 ui_dlg_box("Clients",<<%dlg% {region} [.30,15i^#rec[\].lastname]; <%I=$a5_record_first%First Record!first> <%I=$a5_record_previous%Previous Record!previous> [.5i!i_changed] <%I=$a5_record_next%Next Record!next> <%I=$a5_record_last%Last Record!last>; {endregion}|{sp}| {region} Lastname: | {text=30:rec[i].lastname}; Firstname: | {text=30:rec[i].firstname}; Phone: | {text=30:rec[i].phone}; Address 1: | {text=30:rec[i].address1}; Address 2: | {text=30:rec[i].address2}; City: | {text=30:rec[i].city}; State: | {text=30:rec[i].state}; Zip: | {text=30:rec[i].zip}; {endregion} %dlg%,<<%code% if inlist(a_dlg_button,"first","previous","next","last") then select case a_dlg_button = "first" i = 1 case a_dlg_button = "previous" if i > 1 then i = i - 1 end if case a_dlg_button = "next" if i < rec.first_empty("lastname") - 1 i = i + 1 end if case a_dlg_button = "last" i = rec.first_empty("lastname") - 1 end select a_dlg_button = "" end if 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 if a_dlg_button = "lastname_changed" then rec[i].lastname = rec[i].lastname a_dlg_button = "" end if %code%)