Page 1 of 1

Graphic Buttons

Posted: Tue Feb 09, 2016 12:13 pm
by oakej
Firstly I'm very new to Profound. I have a program that uses an indicator called @S1OPT in my subfile which accepts: 1 (View), 2 (Edit) and 4(Delete). I would like to use the graphic buttons of View, edit and delete to handle this so I can remove my cheesy combo box that has an Id of @S1OPT from the conversion. However I don't know how to link or bind those buttons to my @S1OPT inticator.

Re: Graphic Buttons

Posted: Tue Feb 09, 2016 2:17 pm
by Colin McNeill
Hi John,

You can bind your '@S1OPT' indicator on the graphic buttons using the 'response' property. Please let us know if this answers your questions.

If you have more questions, please send an email to support@profoundlogic.com

Thanks!

Colin

Re: Graphic Buttons

Posted: Tue Feb 09, 2016 3:12 pm
by Scott Klement
I'm guessing that @S1OPT is not really an 'indicator'? Indicators can only have values of '0' (*OFF) or '1' (*ON). It sounds like you have a variable that's intended to contain an option, 1=View, 2=Edit, 4=Delete.

A button, however, only has two possibilities... either it has been clicked or it hasn't. So an indicator is the natural response to a button... But the @S1OPT field doesn't seem like the right sort of field to he used as the response to a button because it isn't really an indicator.

What you could do, if you still want to use this @S1OPT field is assign actual indicators to each button, for example make indicators named btnView, btnEdit and btnDelete and bind these variables to the 'response' property of the three buttons. Then, in the RPG program you would do this:

Code: Select all

select;
when btnView = *on;
   @S1OPT = '1';
when btnEdit = *on;
  @S1OPT = '2';
when btnDelete = *on;
  @S1OPT = '4';
other;
  @S1OPT = ' ';
endsl;
Though, of course, depending on how your code was written, it may be better/nicer to just change the rest of the program to look fo the btnView, btnEdit and btnDelete values directly and remove the @S1OPT field completely.

Also, because this is in a subfile, you'll need to turn the values off again and update the subfile so the buttons are not "stuck on". Youl'd do that with some code like this:

Code: Select all

btnView = *off;
btnEdit = *off;
btnDelete = *off;
update MYSFLREC;