DC_EditControlLastFocus() and EDITPROTECT

This forum is for eXpress++ general support.
Post Reply
Message
Author
ivanvazan
Posts: 21
Joined: Tue May 18, 2010 5:57 am

DC_EditControlLastFocus() and EDITPROTECT

#1 Post by ivanvazan »

Roger,
I think there is an issue with your newly added function DC_EditControlLastFocus().
You get an error if you have a screen with some dc_gets and dc_pushbuttons and all gets on the screen are EDITPROTECTed and the button has DC_EditControlLastFocus() in the action clause. System does not recognize this situation and does not return the focus to the tab page itself (or any other available object if there is no tab page, just a DC_STATIC). Error code is BASE/2266 (receiver of message is not an object).
Please refer to my attached sample code for testing (just click on the button and close the action message).
Attachments
Test.zip
(7.71 KiB) Downloaded 614 times

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DC_EditControlLastFocus() and EDITPROTECT

#2 Post by rdonnay »

Ivan -

There is nothing wrong with DC_EditControlLastFocus().
The reason there is no object is because there was never any object that received focus because the gets are all protected.

When you have code like that, just make a change like so:

Code: Select all

@ 0, 1 DCPUSHBUTTON ;
    CAPTION "Push Me" ;
    SIZE 10, 1.2 ;
    ACTION { |o|o := DC_EditControlLastFocus(GetList), ;
                DC_MSGBOX( ,, { "Close this message box and", "you will NOT get an error." } ), ;
                IIF(Valtype(o)=='O', DC_SetAppFocus(o),nil) }
The eXpress train is coming - and it has more cars.

ivanvazan
Posts: 21
Joined: Tue May 18, 2010 5:57 am

Re: DC_EditControlLastFocus() and EDITPROTECT

#3 Post by ivanvazan »

That solved it. Thanks Roger, I appreciate it.

Post Reply