hiding button doesn't work

in grid

add a button say “btn_my_button”

OnScriptInit as discribed in the manual, it does hide the built_in buttons but doesn’t hide the button that you create inside the application!!

I’m using this cose



if ({field}==1)
{
sc_btn_display("btn_my_button", 'off')
}


also tried sc_btn_display(“my_button”, ‘off’)

any idea how to hide a self-made button based on logged in user of field value in the grid or even in the form!?

Didn’t tried on grid. I use it on FOrm this way:


if ({facturado}) { sc_btn_display('Generar', 'off'); }

[QUOTE=Giu;33268]Didn’t tried on grid. I use it on FOrm this way:


if ({facturado}) { sc_btn_display('Generar', 'off'); }

[/QUOTE]

yes tried that actually doesn’t work, don’t know whats wrong :frowning:

Hello Mike:

remember that in grids the fields are blank in the onScriptInit Event, they get assigned in the OnRecord event and the hidding of a button cant be done in that event.

I’m affraid you’ll have to execute a query in the onscriptinit even, evaluate it and then hide the button.

Regards

Oh then it is a problem for me, I really have a link/function assigned to a button in the grid and I want to disable it unless the user is from specific group do you have any other idea to do that? and what query does it need? do you think we can put it in the header as a link/image too as global variable will be easier? I really hate what dealing with globals as sometimes they mix up and don’t take correct values unless you refresh, they are like caching the previous values and don’t show the new ones unless you click again on their link… which is weird clicking twice in order to get what you need!

Hey mike:

I can help you but i need more info, please post some screenshots of how your form is and the value you want to evaluate.

Regards

hi kafecadm,

thanks for your feedback, it is not new of you helping all other dear :slight_smile:

okay it is simple I have a button on a grid called “btn_showdata”

i want to show it in the grid only if one of the grid fields ==2, if not 2 then I want to hide it…

I’ve no problem to make the button to show in the header as global i want to pass one parameter

whichever is easier dude, just hint me up to go :smiley:

Hey Mike:

You see, this is what i don’t get, you have a grid(in other words a report) and if one record has a column = 2 then you wanna hide the button. so that makes me think you are filtering such report to show you information for a single customer(so to speak) am I right?.

hi pal,

it is yes and no. simply its a grid with slide and partial data, like 1 line per page

just think of it like one column is “class==1” then the button will not show but if the column is “class==2” then the button should show

Ok Se should’ve started there:

Use sc_btn_disabled macro in the OnHeader event

everytime you navigate between records the application is reloaded and the onHeader event is executed. meaning you can reevaluate your field and decide if you want or not to disable the button.

so… Friday… who’s up for some DRIIIIIIIIIIIIIIIIIIIIINKSSSSSSSZZZSZSZSZSZSZSZSZSZ

Cheers dude, lets drink for now, forget the onHeader event and lets forget bartho too, we can try on Monday when we are awake again hehehe

in mood for some Tequila and black label, if you know what I mean :wink:

My kind of party lol have a great weekend

same to you bro, and thanks a lot

till Monday :smiley: