Decorate buttons

Author: (rogerw)

Hi, the code below puts leftaligned pictures on a button of an entity. Each occurrence has it's own picture (=the name of the occurrence-id) or then the picture is missing and then a default picture should be used. Is it possible to do this in a more effective way not having to do the $fileexist-check. Eg. using glyphs or somehow putting a default picture on the button that won't be replaced by the !-char as you try to put a missing picture on the button. I haven't used a lot of pictures so the solution could be easy or then it's not possible to do this in another way....  Regards RogerW. entry DecorateBtns   $properties(tran_desc.mnu_tran) = "representation=Uniface·;ImageLabelAlign=left·;imgsize=IMG_xlarge"   forentity "mnu_tran"      if($fileexists("%%tran_id.mnu_tran%%%.png")=0)        tran_desc.mnu_tran="@mnudefault.png·!%%tran_desc.mnu_tran%%%"      else        tran_desc.mnu_tran="@%%tran_id.mnu_tran%%%.png·!%%tran_desc.mnu_tran%%%"      endif   endfor end; DecorateBtns ;tran_id is the id of the occurrence and ;tran_desc is the button and the text of the occurrence


  1. Hi Roger, Not sure if you're using a grid - or just plain 'normal' occurrence scrolling? However, I'd prefer to use either the trigger on a db field - or - shock horror - the READ trigger for this. The main reason would be processing the whole hitlist vs just the 'visible' part of the stepped hitlist. Also, since you know where the files are - depending on the number of files of course - I'd probably suggest doing a $ldirlist in the EXEC trigger to get a list of all the files. Once in the DECR / READ trigger, I'd go down the getitiem/id path rather than hitting the file system for each record read. This way you'll get one hit on the file system rather than (potentially 100's or 1000's of file system accesses). Regards, Knut

    Author: Knut (
  2. Hi Knut, yes I started to think the same way, ie. building a list to use for checking. Especially as this is a menu that is displayed again and again. $ldirlist was a good idea! Regards RogerW.

    Author: rogerw (
  3. Hi Roger, Sorry - just realized that this wonderful WYSIWYG editory doesn't like the script tags < and their evil twin the greater sign. There's a trigger missing in my previous post - should be the DECR trigger - my bad for enclosing in the evil twins signs. Knut

    Author: Knut (