How to get position of focused field on entity with multiple painted occs ??

Author: vojta@incad.cz (vojta)

I have  problem to detemine , which painted occ is used for current occ of entity with multiple painted occurences. I want to position the next form relatively to focused field, but I am not able  to get its position. props=$paintedfieldproperties(pfieldname, ??? ) Has anybody idea how to do it ? client/server application, Uniface 9401 Thanks.

10 Comments

  1. Sorry but, $curocc != painted occurrence.  If I have three occs painted on the form, and 62 occs retrieved, depending on where the scroll bar is painted occ 1 could be showing any of the 62 occs from 1 - 59.  You cannot tell from curocc which painted occ is currently occupied by that data. There aren't even any mildly workable assumptions. I don't think it's even possible to tell from occgetsfocus which painted occ just got focus, so it can't be set there. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  2. This should do it.... variables string vs_paintfieldprops endvariables $occ_seq$ = "" call lp_get_outer($entname) ; $occ_seq$ contains occno's from innermost to outermost (where you are now). vs_paintfieldprops = $paintedfieldproperties($fieldname, $occ_seq$) message/info vs_paintfieldprops end entry lp_get_outer params string psi_entname : IN endparams variables string vs_entname numeric vn_curocc endvariables vn_curocc = $curocc("%%psi_entname") if ($occ_seq$ != "") $occ_seq$ = $concat($occ_seq$, "gold;", vn_curocc) else $occ_seq$ = vn_curocc endif vs_entname = $entinfo(psi_entname, "OUTER") if (vs_entname != "") ; call self recursively to get to the outermost entity call lp_get_outer(vs_entname) endif return(0)


    Author: Knut (knut.dybendahl@gmail.com)
  3. indeed - you're right.... I thought $framedepth would do it for me - yes, it returns the number of occurences painted on the screen - but I can navigate up/down the hitlist and all I'll ever know is that I'm somewhere inside the painted frame... $occdepth returns the depth of the occurence - but, alas, no joy here either. I'll park this one for some further thinking....


    Author: Knut (knut.dybendahl@gmail.com)
  4. There is no function to get the number of painted occurrences. $framedepth returns lines, not occs, so when your occurrences are 2 or 3 lines deep it is not the answer you are looking for. It gets even more difficult when you use a grid, as there is no number of painted occurrences. If you want to popup a from besides a field it is probably best to move to Uniface 9.6. In Uniface 9.6 we have introduced Popup Forms that can be connected to a field. It was designed to solve your problem.


    Author: Theo Neeskens (tneeskens@itblockz.nl)
  5. Please, be aware, that popup forms are non-modal forms (and can be used only upon non-modal forms). If you have a modal form, you can't use any popup form. And the second limitation is, that Popup forms can not be used upon Grid. So if you have a non-modal form without Grid, you can move to Uniface 9.6 and try out popup, otherwise AFAIK there is no way to solve this within Uniface :(.


    Author: sochaz (zdenek.socha@fullsys.cz)
  6. Thanks  for advice.  I understand , 9.6 is solution ...


    Author: vojta (vojta@incad.cz)
  7. But only to this particular problem. It would still be very useful to be able to have a grasp of which occurrences of an entity were "in view". 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  8. $framedepth / $occdepth ===> # of occurences painted... But, nothing will tell you (afaik - atm) the actual, current number of the 'repeated occurence' you're on...


    Author: Knut (knut.dybendahl@gmail.com)
  9. Hello Theo and KnutD, how about function $paintedocc? Wink We use this to change position and/or size of editboxes in all occurences (because $paintedfieldproperties changes only provided painted occurence... so we have a loop).  Taken from Uniface Library...: $paintedocc Return the number of occurrences painted for the specified entity. $paintedocc{(Entity)}


    Author: sochaz (zdenek.socha@fullsys.cz)
  10. That does provide a number which is a true number, but it's not a useful one in this respect.  It is not possible to tell which painted occurrence is currently occupied by the occurrence with focus at the moment, unless there are more painted occurrences than retrieved occurrences, or there is only one painted occurrence.  An assumption that the map is $curocc mod $paintedocc is easily broken, by scrolling one line at a time rather than a page at a time (in fact, I think uniface's page behaviour breaks it on the first scroll down. ) There is no way to tell where on the form your current occ is, or which occurrences are in view at any point in time. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)