I don’t know how to handle this problem:
I have a get-field with a valid.
In case of backward navigation the valid should not be executed.
Thanks in advance
Otto
I don’t know how to handle this problem:
I have a get-field with a valid.
In case of backward navigation the valid should not be executed.
Thanks in advance
Otto
You could check for Shift-Tab, but a user could click on any other control. You would have to know which controls are before the Get with the valid.
Perhaps if you could explain what you are trying to do, someone can come up with another solution. Maybe the valid is dependent on another control's data? Why would the valid not need to be checked when moving backward?
Regards,
James

Otto,
OK. Does this mean that the record is for a previously reserved room and thus the entire record should only be read-only? Or, is this a new record?
Is the room number automatically filled in by the system after the dates are entered?
Tell me more how this all works.
James
Hello James,
this could be a new one or a previously reserved one where someone wants to change his arrival or the departure date. The room number is entered manually. 95% of the users navigate with the mouse. At the moment I have the valid check on the room number get field. If the room is not free you “hang” in the get field.
I thought there is maybe a build in method or you could check if you navigate up or down .
Best regards,
Otto
Otto,
OK, this will probably answer your question but I am not sure it is a very good interface design.
You could disable the arrival and departure date fields when the room no field is not empty. I suggest disabling them since they will then be grayed out and it will be obvious to the user that they cannot be changed. However, it will not be obvious WHY they cannot be changed.
What does the user do when they want to change one of the dates? Do they have to clear the room number field?
How does the user know what room numbers are available for the dates?
What you originally asked for seems that it would still allow the user to enter any room no. Having it hang in the field when the room is unavailable is not good. It is much better if you can prevent the user from having the option to enter "invalid" data. As a designer we want to avoid (at all cost) telling the usesr that they did something wrong. It would be worse to leave them wondering why they can't leave the field with no explaination.
Perhaps an better solution would be to use a listbox for the rooom no and fill it out automatically when the user enters the dates. Then they get a list of all available room no's for the date range AND they cannot enter an unavailable room no. For a small number of rooms this should be fast enough.
Actually, maybe a disabled GET with a Lookup button next to it would be better than a listbox. There would be a lag with a listbox, however when using a Lookup button the user expects a delay.
I did some work on a reservation system awhile back and I do remember it being quite complicated. I expect I still have the code that looks for available rooms for a date range, however, another idea just came to me that might make it much simpler. I would have to think on it some more.
James
Hello James,
thank you for your help. As I didn’t found a solution how to disable valid navigating upwards I thought of forcing the system to navigate upwards with Setfocus().
iif(oSelf:verfuegbarkeiten(oDlg), ( oGetAnreise:refresh(), oGetAbreise:refresh(), oGetZiNr:refresh(),.t. ), (oGetAbreise:setfocus(),.t.) ) )
It seems that this could be a solution for me.
I have a listbox in a popup if a wrong date or room no is entered. But if you leave the listbox with cancel it should be possible to leave the get field too. Now with setfocus() I can.
You are right the search for free rooms is a little time consuming. I will remember having seen some code you posted on this issue on the forum. I have to search the forum.
Best regards,
Otto
freieZimmer := TBelegung():new()
freieZimmer:setorder(4) //freieZimmer:zimmernr + dtos(freieZimmer:abreise)
freieZimmer:seek(::cZiNr)
if freieZimmer:found() = .T.
freivom := ARR_ANREISE
do while freieZimmer:zimmernr = adr->zimmernr
...
freieZimmer:skip(+1)
enddo
endiffreieZimmer->(ordScope(0, dtos(zimmernr) )) // set top scope
freieZimmer->(ordScope(1, dtos(zimmernr) ) ) // set bottom scope
freieZimmer->(dbgotop())freieZimmer := TBelegung():new()
freieZimmer:setorder(4) //freieZimmer:zimmernr + dtos(freieZimmer:abreise)
(freieZimmer:cAlias)->( OrdScope(0, adr->zimmernr + dtos( ARR_ABREISE ) ) ) //99920100401
(freieZimmer:cAlias)->( OrdScope(1, adr->zimmernr + "A" ) ) //999A
freieZimmer:gotop()
if freieZimmer:eof() = .f.
freivom := ARR_ANREISE
do while freieZimmer:zimmernr = adr->zimmernr
...
freieZimmer:skip(+1)
enddo
endifWhen we SET OPTIMIZE ON on DBFCDX, both OrdScope and DbSetFilter() work with acceptable speeds, if we create indexes in the right way, even on quite large tables.
It is a good idea to popup of a list of unoccupied rooms and let the user select one of them.
Otto,
It looks like you are using scopes to search only for a certain room. Perhaps this is useful for when the customer wants a particular room, but to search for any available room is another matter.
James
Hello James,
Yes. But I browse the whole room database and with the routine I posted I search after the vacancies in this certain room and write it into an array which I browse in a popup window.
So fare I didn’t found a quicker method.
Best regards,
Otto
But I browse the whole room database and with the routine I posted I search after the vacancies in this certain room and write it into an array which I browse in a popup window.
ASIZE(::afrei,0)
Select room
do while .not. EOF()
::cZiNr:= field->zimmernr
::Lookup_ vacancies () //Buchung
select room
skip
ENDDOOtto,
So is this returning an array of available date ranges? What to you do with that?
One of my routines is:
isFree( nRoom, dArrival, dDeparture)
It returns a logical.
Like your routine, there is a loop through all available rooms and the available rooms are added to an array. This array can be used in a listbox or browse.
James