Hi,
I have a browse menu and I need to make action of a button (approve button) so if the button is selected the button will change the field value into 1 and disable the change and delete button and also change the button string value into unapprove . But if the button were selected again the value will be return into approve and the value change into 0 and the button of change and delete will be return to enable again . can anyone can help ?
if the button is selected the button will change the field value into 1 and disable the change and delete button and also change the button string value into unapprove
if selected() = ?btnApprove
if ?btnApprove{prop:text} = 'Approve'
field:value = 1
disable{?btnChange)
disable(?btnDelete)
?btnApprove{prop:text} = 'Unapprove'
else
!- do it yourself
end
end
Thereās some stuff here that would kind of depend on the underlying data, rather than just coding a button. Do you intend to enforce these rules (being allowed to modify/delete) elsewhere in your application? Will any other apps ever use the same data?
Hi,
I try this script but still not workingā¦
if selected() = ?button8
if ?button8{prop:text} = āApproveā
PRh:sts = 1
disable(?Change:4)
disable(?Delete:4)
?button8{prop:text} = āUnapproveā
else
if ?button8{prop:text} = āUnApproveā
PRh:sts = 0
enable(?Change:4)
enable(?Delete:4)
?button8{prop:text} = āApproveā
end
end
end
not working what? Maybe this - PRh:sts = 1? or this - disable(?Change:4)? Or not working everything?
Pay attention that this code will executed only if ?button8 is selected.
Also in one place you set one text (āUnapproveā), in another you test it against different text (āUnApproveā).
If you want to disable the delete and change button in an ABC browse you need to embed your logic in the browse UpdateWindow method after the parent call. This method is going to enable disable those buttons automatically. Test your condition and enable/disable appropriately.
The other option is to clear the browse classes control properties for delete/change.
Add the following with your enable/disable lines in your example above change to:
clear(BRW1.ChangeControl)
clear(BRW1.DeleteControl)
and
BRW1.ChangeControl = ?Change:4
BRW1.DeleteControl = ?Delete:4
Dear Rick,
Does it working after the button of change and delete were selected? cause I need the condition that if the sts field value is 1 or the button string were unapproved both button will be disable.
As for my understanding, you are trying to create a browse for purchases that the user can āApproveā or āUnapproveā a purchase record right?
If I hit it, this is what will I doā¦
Borrowing and editing the code from seanh
IF PRh:sts = 1
disable(?Change:4)
disable(?Delete:4)
?button8{prop:text} = āUnapproveā
else
enable(?Change:4)
enable(?Delete:4)
?button8{prop:text} = āApproveā
end
Embed it to the accepted event of your browse. See sample image below
Put this codes after your codes for changing the value.
Sample
GET(YourTable,YourKey)
IF NOT ERRORCODE()
! Your codes
PUT(YourTable)
END
Add this here
BRWn.ResetQueue(1)
BRWn.ResetFromView
DISPLAY
This script is for the browse accepted event.
IF PRh:sts = 1
disable(?Change:4)
disable(?Delete:4)
?button8{prop:text} = āUnapproveā
else
enable(?Change:4)
enable(?Delete:4)
?button8{prop:text} = āApproveā
end
And this is for ?Button8 accepted event
GET(YourTable,YourKey)
IF NOT ERRORCODE()
IF PRh:sts = 1
PRh:sts = 0
ELSE
PRh:sts = 1
END
PUT(YourTable)
END
BRWn.ResetQueue(1)
BRWn.ResetFromView
DISPLAY
I got errors on
BRWn.ResetQueue(1) --> field not found ResetQueue
BRWn.ResetFromView --> field not found
unknown procedure labelā¦
can you tell me why?