Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: PictureFlow  (Read 6802 times)
ed m.
Posts: 2


« on: July 03, 2010, 08:41:57 pm »

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!
.
Four Js
Posts: 115


« Reply #1 on: July 04, 2010, 05:37:52 pm »

Ed,
you can try the following:

in your .4st file, add:

Code
  1.  <Style name="Image">
  2.     <StyleAttribute name="imageCache" value="1" />
  3.  </Style>
  4.  <Style name="Table.pflow">
  5.     <StyleAttribute name="tableType" value="pictureFlow" />
  6.     <StyleAttribute name="backgroundColor" value="#AEC9F6" />
  7.     <StyleAttribute name="border" value="none" />
  8.  </Style>
  9.  

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
  1. LAYOUT (MINWIDTH=80, MINHEIGHT=20)
  2. GRID
  3. {
  4.  <T t              >
  5.   [a              ]
  6.   [a              ]
  7.   [a              ]
  8.   [a              ]
  9.   [a              ]
  10.   [a              ]
  11.  
  12.  [nm               ]
  13. }
  14.  
  15. END
  16. END
  17.  
  18. ATTRIBUTES
  19. IMAGE a = FORMONLY.a;
  20. EDIT nm = FORMONLY.nm;
  21. TABLE t : style="pflow";
  22.  
  23. END
  24. INSTRUCTIONS
  25. 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
  1.   IF path IS NULL || NOT os.Path.exists(path) || NOT os.Path.isdirectory(path)
  2. THEN
  3.      CALL ui.Interface.frontcall("standard","opendir", ["Select directory", ""]
  4. ,[path])
  5.   END IF
  6.  
  7.   call files.clear()
  8.  
  9.   LET idx = 1
  10.   CALL os.Path.dirsort("name", 1)
  11.   DISPLAY "*** " , path
  12.   LET h = os.Path.diropen(path)
  13.   DISPLAY h
  14.   WHILE h > 0
  15.      LET child = os.Path.dirnext(h)
  16.      IF child IS NULL THEN EXIT WHILE END IF
  17.      IF child == "." OR child == ".." THEN CONTINUE WHILE END IF
  18. --      DISPLAY child
  19.      LET files[idx] = path || "\\" || child
  20.      LET idx = idx + 1
  21.   END WHILE
  22.   CALL os.Path.dirclose(h)
  23.  
  24. END FUNCTION
  25.  


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

Code
  1. fglrun pFlow c:\mypics
  2.  

will display c:\mypics images in the pictureflow.

Let me know if it works on your side.

* picFlow.zip (1.49 KB - downloaded 604 times.)
ed m.
Posts: 2


« Reply #2 on: July 06, 2010, 02:44:45 pm »

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
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines