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: Simple display of a record not handled by dialog instruction  (Read 8703 times)
Jeroni C.
Posts: 17


« on: November 13, 2008, 06:08:02 pm »

Hi,

We're trying to apply multiple dialogs in our program but we've found one problem.
 
We have a typical master-detail (multiple detail really) form with some pages. In the first one, we display a record, and in the others, we display one array in each page. So we have
 
page 1. Record1.
page 2. Array 2
page 3. Array 3.
 
The user can move through the rows of the master table and we have to refresh the details.
We use the instruction dialog with the sub-dialogs 'display array 2' and 'display array 3', but we can't use a sub-dialog 'display by name' for the record on page 1 because multiple dialogs instruction does not allow this kind of sub-dialog. So, when displaying data, the active page is page 2, and not page 1 as desired. In addition, if we select page 1 and then click anywhere in this page, the control returns to the page whose array is being displayed at the moment.

Regards,
Jeroni
Sebastien F.
Four Js
Posts: 509


« Reply #1 on: November 13, 2008, 06:34:04 pm »

There are different programming patterns for DIALOG.

I suggest that you look at the demos in FGLDIR/demo/MultipleDialogs

And please read carefully the manual page of the DIALOG instruction.

If you want that your master fields are active, you must use an INPUT BY NAME.

If the master fields must remain disabled (not used by DIALOG), just do a DISPLAY BY NAME in the BEFORE DIALOG block.

Seb
Reuben B.
Four Js
Posts: 1047


« Reply #2 on: November 14, 2008, 05:48:39 am »

Hi Jeroni,

Steal some ideas from the following ...

Using an INPUT with UNBUFFERED and the master fields disabled enables you to use the UNBUFFERED functionality where if you change a value it is immediately refreshed on the screen. 

The dummy field displays on Vista as a 1 pixel that flashes, you may have to alter the style on other platforms to get something that is as invisible as I've managed to get it.  By having it the first folder tab now has something it can attach the focus to so hence the first folder tab is displayed when you enter the dialog.

Hope that helps,

Reuben


Code
  1. <StyleList>
  2.   <Style name=".dummy" >
  3.      <StyleAttribute name="fontSize" value="1pt"/>
  4.      <StyleAttribute name="border" value="no" />
  5.   </Style>
  6. </StyleList>

Code
  1. LAYOUT
  2. FOLDER f1
  3. PAGE p1(TEXT="Master")
  4. GRID
  5. {
  6. [m01      ]
  7. [m02      ]
  8. [m03      ]
  9. [d]
  10. }
  11. END
  12. END
  13. PAGE p2(TEXT="Detail")
  14. TABLE
  15. {
  16. [d01    ][d02     ][d03     ]
  17. }
  18. END
  19. END
  20. PAGE p3 (TEXT="SubDetail")
  21. TABLE
  22. {
  23. [s01    ][s02     ][s03     ]
  24. }
  25. END
  26. END
  27. END
  28. END
  29. ATTRIBUTES
  30. d = formonly.dummy, INVISIBLE, STYLE="dummy";
  31. m01 = formonly.mfield1;
  32. m02 = formonly.mfield2;
  33. m03 = formonly.mfield3;
  34. d01 = formonly.dfield1;
  35. d02 = formonly.dfield2;
  36. d03 = formonly.dfield3;
  37. s01 = formonly.sfield1;
  38. s02 = formonly.sfield2;
  39. s03 = formonly.sfield3;
  40. INSTRUCTIONS
  41. SCREEN RECORD master(mfield1,mfield2,mfield3);
  42. SCREEN RECORD detail(dfield1,dfield2,dfield3);
  43. SCREEN RECORD subdetail(sfield1,sfield2,sfield3);

Code
  1. IMPORT util
  2. DEFINE master RECORD
  3.   mfield1, mfield2, mfield3 STRING
  4. END RECORD
  5.  
  6. DEFINE detail DYNAMIC ARRAY OF RECORD
  7.   dfield1, dfield2, dfield3 STRING
  8. END RECORD
  9.  
  10. DEFINE subdetail DYNAMIC ARRAY OF RECORD
  11.   sfield1, sfield2, sfield3 STRING
  12. END RECORD
  13.  
  14. MAIN
  15. DEFINE dummy CHAR(1)
  16.  
  17.   OPTIONS INPUT WRAP
  18.   CALL ui.Interface.LoadStyles("20081114a")
  19.  
  20.   OPEN WINDOW w WITH FORM "20081114a"
  21.   CALL populate()
  22.  
  23.   DIALOG ATTRIBUTES(UNBUFFERED)
  24.  
  25.      INPUT dummy FROM dummy
  26.      END INPUT
  27.  
  28.      INPUT master.* FROM master.* ATTRIBUTES(WITHOUT DEFAULTS=TRUE)
  29.      END INPUT
  30.  
  31.      DISPLAY ARRAY detail TO detail.*
  32.      END DISPLAY
  33.  
  34.      DISPLAY ARRAY subdetail TO subdetail.*
  35.      END DISPLAY
  36.  
  37.      BEFORE DIALOG
  38.         CALL dialog.setFieldActive("master.mfield1",0)
  39.         CALL dialog.setFieldActive("master.mfield2",0)
  40.         CALL dialog.setFieldActive("master.mfield3",0)
  41.  
  42.      ON ACTION next
  43.         CALL populate()
  44.         DISPLAY master.* TO master.*
  45.  
  46.      ON ACTION previous
  47.         CALL populate()
  48.         DISPLAY master.* TO master.*
  49.  
  50.      ON ACTION close
  51.         EXIT DIALOG
  52.  
  53.   END DIALOG
  54. END MAIN
  55.  
  56. FUNCTION populate()
  57. DEFINE i,j INTEGER
  58.   LET master.mfield1 = util.Math.rand(100)
  59.   LET j = util.Math.rand(100)+1
  60.   CALL detail.clear()
  61.   FOR i = 1 TO j
  62.      LET detail[i].dfield1 = util.Math.rand(100)
  63.   END FOR
  64.   LET j = util.Math.rand(100)+1
  65.   CALL subdetail.clear()
  66.   FOR i = 1 TO j
  67.      LET subdetail[i].sfield1 = util.Math.rand(100)
  68.   END FOR
  69. END FUNCTION

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Jeroni C.
Posts: 17


« Reply #3 on: November 17, 2008, 11:07:30 am »

Hi Reuben,

Thanks for your idea, this solved our problem, the dummy field in XP also is a 1 pixel that flashes that is almost invisible.

Regards,
Jeroni
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines