Page 1 of 1
Editprotect and popup and combo buttons.
Posted: Fri May 27, 2011 2:21 am
by PedroAlex
Hello comunity.
My situation is ,
I want the users can not modify the get, remove every keyboard entry, but still will allow to click on popup button or combo button.
How I can do this??
Any ideia, I appreciate.
Thanks in advance.
i put here some code to be evaluate..
Code: Select all
#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"
#INCLUDE "dcicon.CH"
* -----------
FUNCTION Main()
LOCAL dDate := Date(), GetList[0], GetOptions, dPaym:=Space(20), aPay:={'Visa','MasterCard','A.Express'}
@ 00,00 DCSAY 'Enter Date' Get dDate EDITPROTECT {|| .t. } POPUP {|d|DC_PopDate(d,,,,'Seleccione Data',,2)}
@ 02,00 dcsay ' Payment' get dPaym EDITPROTECT {|| .t. } ;
COMBO ;
HEIGHT 7 WIDTH 20 ;
DATA aPay ELEMENT 1
DCREAD GUI FIT ADDBUTTONS MODAL SETAPPWINDOW
RETURN nil
PROC appsys
RETURN
Best Regards
Pedro Alex
Re: Editprotect and popup and combo buttons.
Posted: Fri May 27, 2011 3:14 am
by Tom
Hi, Pedro.
Set DC_GetPopupProtectHide(.T.) somewhere in your app. This will automatically hide popup- and combo-buttons if a get is edit-protected.
Re: Editprotect and popup and combo buttons.
Posted: Fri May 27, 2011 4:36 am
by PedroAlex
Tom. Thanks for reply.
I did not explain correctly.
I want the user can click only on the button and change the get only from the popup or combo button, but de get protected by editprotect.
It is possible?
Thanks for attention.
Pedro
Re: Editprotect and popup and combo buttons.
Posted: Fri May 27, 2011 5:02 am
by Tom
Hi, Pedro.
Code: Select all
cTest := Space(30)
@ 1,1 DCGET cTest POPUP {||cTest := MyPopUpValue} KEYBLOCK {|a,b,o|o:Undo()}
Easier way: Create DCCOMBOBOXes instead.

Re: Editprotect and popup and combo buttons.
Posted: Fri May 27, 2011 7:57 am
by rdonnay
I want the user can click only on the button and change the get only from the popup or combo button, but de get protected by editprotect.
Try this:
@ .. DCGET xVar POPUP bPopup KEYBLOCK {|a,b,o|o:undo()}
Re: Editprotect and popup and combo buttons.
Posted: Sat May 28, 2011 1:26 am
by PedroAlex
Roger and Tom.
Many thanks for you try support my question,
but it looks you do not understaind my problem.
take a look on code sample I poste on first topic.
The problem is :
IF EDITPROTECT is .t. I can not insert data from keyborad, and I can not choose data from the combo button or popup button too, and this is the problem.
I want the combo or popu button is enable and work fine when the editprotect clause is .t.. Something like Dc_Popupprotect( .f. ). This way the get can be protect but the button not, and the user can change the get only from the data result the button code ( array or browse a file ).
This can prevent for many errors typical from data inserted from keyboard.
I can do this with a separated button and get, but will be more easy if it is included on dcsay....get....combo or popup.
the developper can control the protect clause of the get and the protect clause of the button separately.
thanks again and sorry for insist.
Best regards
Pedro Alex.
Re: Editprotect and popup and combo buttons.
Posted: Sat May 28, 2011 6:42 am
by BruceN
Why not use a valid? like:
LOCAL a_IP := {'Invoice','Product','Department','Vendor'}, aIP:={'I','P','D','V'}
@ 7, 1 DCsay "Sort By"
@ 7, 15 dcget sortby pict '!';
TABSTOP;
GETSIZE 2.5;
GETFONT '8.ARIAL';
VALID {|o|ASCAN(aIP,o:GetData()) > 0};
COMBO HEIGHT a_len(a_IP) WIDTH a_wd(a_IP) DATA a_IP RETURN {|n|aIP[n]};
lostfocus{||dc_getrefresh()}
User can type or select data... but it fhat forces the data to be from your list.. isn't that what you want?
if so.... glad I could help.
Re: Editprotect and popup and combo buttons.
Posted: Sat May 28, 2011 8:02 am
by rdonnay
but it looks you do not understaind my problem.
I DO understand your problem.
If you want the buttons to work, you must removed the EDITPROTECT clause.
If you want to prevent keyboard entry, you must use the .. KEYBLOCK {|a,b,o|o:undo()} clause.
Re: Editprotect and popup and combo buttons.
Posted: Mon May 30, 2011 2:01 am
by PedroAlex
Roger, you're right!
KEYBLOCK clause works fine..
many thanks for your time.
Best Regards.
Pedro Alex