PictureFlow

Started by ed m., July 03, 2010, 08:41:57 PM

Previous topic - Next topic

ed m.

Does anyone have example code for using the Table.pictureFlow style?   Can't seem to get it to work.   I'm using 2.21.04

Thanks!

.

Ed,
you can try the following:

in your .4st file, add:

Code (xml) Select
  <Style name="Image">
     <StyleAttribute name="imageCache" value="1" />
  </Style>
  <Style name="Table.pflow">
     <StyleAttribute name="tableType" value="pictureFlow" />
     <StyleAttribute name="backgroundColor" value="#AEC9F6" />
     <StyleAttribute name="border" value="none" />
  </Style>


This will allow:
- to use image cache and not reload images everytime
- define a picture flow image, with a background and no border

A small .per:
Code (per) Select

LAYOUT (MINWIDTH=80, MINHEIGHT=20)
GRID
{
<T t              >
  [a              ]
  [a              ]
  [a              ]
  [a              ]
  [a              ]
  [a              ]

[nm               ]
}

END
END

ATTRIBUTES
IMAGE a = FORMONLY.a;
EDIT nm = FORMONLY.nm;
TABLE t : style="pflow";

END
INSTRUCTIONS
SCREEN RECORD sr(a);


And the 4gl:

IMPORT os
DEFINE files DYNAMIC ARRAY OF STRING


MAIN
DEFINE restart SMALLINT

OPEN FORM f FROM "pFLOW" DISPLAY FORM f

CALL populate( ARG_VAL(1) )

IF files.getLength() > 0 THEN


  DISPLAY ARRAY files TO sr.*
   BEFORE ROW
     DISPLAY files[arr_curr()] TO nm
   ON KEY (F5)
     CALL populate( "" )
END DISPLAY
END IF

END MAIN

FUNCTION populate(path)
   DEFINE path STRING
   DEFINE child STRING
   DEFINE h, idx INTEGER

Code (genero) Select
   IF path IS NULL || NOT os.Path.exists(path) || NOT os.Path.isdirectory(path)
THEN
      CALL ui.Interface.frontcall("standard","opendir", ["Select directory", ""]
,[path])
   END IF

   call files.clear()

   LET idx = 1
   CALL os.Path.dirsort("name", 1)
   DISPLAY "*** " , path
   LET h = os.Path.diropen(path)
   DISPLAY h
   WHILE h > 0
      LET child = os.Path.dirnext(h)
      IF child IS NULL THEN EXIT WHILE END IF
      IF child == "." OR child == ".." THEN CONTINUE WHILE END IF
--      DISPLAY child
      LET files[idx] = path || "\\" || child
      LET idx = idx + 1
   END WHILE
   CALL os.Path.dirclose(h)

END FUNCTION



This small test case is aimed to be run with fglrun running on the same machine as GDC.

Code (bash) Select
fglrun pFlow c:\mypics


will display c:\mypics images in the pictureflow.

Let me know if it works on your side.

ed m.

perfect!  thanks Pierre!

I see what I was doing wrong.  In the .per file, you used an image control:
  IMAGE a = FORMONLY.a;

I was trying to use an edit control (since I thought it only needed the name of the file).


Thanks again,
-Ed