1
0
-1

Hi all

I have an entity with 10 painted occurences.

On each occurence, the size of some fields are different depending on the type of data displayed in the occurence. Therefore, I use $paintedfieldproperties to change the size.

But it no longer works if I have more than 10 records in my database. Indeed, the first painted occurence may display the 20th occurence of the database. Indeed, for $paintedfieldproperties, one must specify the painted occurence number, not the current occurence of the hist list

So how can I know on which painted occurence I am for the current occurence of the hitlist ($curocc) ?

    CommentAdd your comment...

    4 answers

    1.  
      2
      1
      0

      Hi Nicolas,

      Trying to match the current occurrence in the hitlist with a painted occurrence on screen is not really straight forward when there are more occurrences in the hitlist than can be displayed. I've tried to come up with a routine to tackle this quite some time ago, but the resulting code was quite cumbersome and error-prone.

      There was a wish for this on the "old" wishlist (that was maintained on the old Uniface.info site). This wish is still open and I don't think that there are any plans to do anything about this. Sorry.

      The best thing is to limit the number of occurrences read from the database to the number of repetitions on screen (i.e. visible occurrences). You then could move through the hitlist by using database pagination. By doing this you can easily match the painted occurrence to the database occurrence.

      Hope this helps.

      Daniel

        CommentAdd your comment...
      1.  
        2
        1
        0

        Hi Daniel

        It's a shame because the only missing data to get it work is the current painted occurence. It would then be easy to calculate the position in the histlist and to refresh the painted fields for the occurences of the list...

        Thanks for the database pagination idea, but it will not be usable for my screen. It manages a list of configurable questions. Then the user can enter the answers, add questions, remove questions, new questions can be cascaded, etc. 

        I'll not spend more time on this development. 

        Many thanks for your help. 

        Nicolas

        1. Daniel Iseli

          Thanks for your feedback. And you are welcome.

          Daniel

        CommentAdd your comment...
      2.  
        1
        0
        -1

        Hi Gilles

        Thanks for your idea. I'll try it. 

        Thanks also Daniel for your advice related to the Format trigger. I'll check

        Regards,

        Nicolas

          CommentAdd your comment...
        1.  
          1
          0
          -1

          Hi All,


          A workaround ? The Format trrigger is activate only for visible occ then :


          1) add a component variable $result$

          2) paint a field in multiocc entity

          3) in the format trigger of this field  add the proc script:

          if($item($curocc,$result$)="")
          putitem $result$,-1,$curocc
          while($itemcount($result$)>$paintedocc($entname))
          delitem $result$,1
          endwhile
          endif

          4) in the entity "occurence get focus" add the proc script :

          postmessage $instancename,"SCROLL",""

          6) in the async interrupt trigger add :

          if($msgid="SCROLL")

          → here get the visible occ  in the $result$

          exemple:  $result$= 8;9;10

             item 1 = paintedocc 1 = occ 8

             item 2 = paintedocc 2 = occ 9

             item 3 = paintedocc 3 =occ 10

          endif


          Cordialy,


          1. Daniel Iseli

            Hi Gilles,

            Thanks for your feedback.

            I've created a similar routine (many years ago), but this really will only work with a static hitlist. As soon as you'll add or remove occurrences then the Format triggers are not fired anymore (at least not in all cases) in a predictable way.

            Kind regards,

            Daniel

          2. Hortion GILLES

            Hi Daniel,

            Yes your are right. the solution is to force the format trigger.

            I resolved the problem with this easy,rapid but blink (and not optimized) solution  :

            Variables

            numeric pos

            EndVariables
            pos=$curocc
            discard $entname,0 or remocc  or creocc ( in this case pos=$curocc must be after this line)
            $result$=""
            setocc $entname,1 
            forentity $entname
            show
            endfor
            setocc $entname,pos

            Not opimized : start loop at curocc-paintedocc  ,stop loop at curocc+paintedocc

            Gilles.


          CommentAdd your comment...