home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 16 / CD_ASCQ_16_0994.iso / news / 4611 / fw16d.ins / IDE / SOURCE / RELATION.PRG < prev    next >
Text File  |  1994-06-05  |  2KB  |  67 lines

  1. #include "FiveWin.ch"
  2.  
  3. //----------------------------------------------------------------------------//
  4.  
  5. function Relations( cAlias )
  6.  
  7.   local oWndRel, oBar, oBrw, oIco, oFont
  8.   local nRel   := 1, cRelAlias
  9.   local hBmpThis := LoadBitmap( GetResources(), "This" )
  10.  
  11.   DEFAULT cAlias := Alias()
  12.  
  13.   DEFINE FONT oFont NAME "Arial" SIZE 6, 15 BOLD
  14.  
  15.   DEFINE ICON oIco RESOURCE "Relation"
  16.  
  17.   DEFINE WINDOW oWndRel FROM 2, 1 TO 15, 50 ;
  18.      TITLE "Relations: " + cAlias ICON oIco MDICHILD
  19.  
  20.   DEFINE BUTTONBAR oBar OF oWndRel
  21.  
  22.   DEFINE BUTTON RESOURCE "New" OF oBar ;
  23.      MESSAGE "Set a new relation"
  24.  
  25.   DEFINE BUTTON RESOURCE "Edit" OF oBar ;
  26.      MESSAGE "Modify this relation"
  27.  
  28.   DEFINE BUTTON RESOURCE "Del" OF oBar ;
  29.      MESSAGE "Cancel this relation"
  30.  
  31.   @ 6, 127 SAY "WorkAreas:" PIXEL SIZE 120, 20 OF oBar ;
  32.      FONT oFont COLOR "W+/N*"
  33.  
  34.   @ 3, 200 COMBOBOX cAlias ITEMS aGetWorkAreas() ;
  35.      SIZE 100, 120 PIXEL OF oBar ;
  36.      COLOR "N/W" FONT oFont ;
  37.      ON CHANGE ( oWndRel:cTitle := "Relations: " + cAlias,;
  38.                  oBrw:Refresh(), oBrw:SetFocus() )
  39.  
  40.   @ 0, 0 LISTBOX oBrw FIELDS "" ;
  41.      FIELDSIZES 25, 200, 200 ;
  42.      HEADERS "Rel", "Expression", "Target Workarea" ;
  43.      OF oWndRel FONT oFont ;
  44.      SIZE 500, 500
  45.  
  46.   oBrw:bLine = { || If( Select( cAlias ) != 0,;
  47.                    { xPadL( cValToChar( nRel ), 20 ),;
  48.                      ( cAlias )->( DbRelation( nRel ) ),;
  49.                      If( ( cRelAlias := Alias( ( cAlias )->( DbRSelect( nRel ) ) ) ) != ;
  50.                          Alias(), cRelAlias, "" ) },;
  51.                    { "", "", "" } ) }
  52.   oBrw:bGoTop    = { || nRel := 1 }
  53.   oBrw:bGoBottom = { || nRel := 8 }
  54.   oBrw:bLogicLen = { || 8 }
  55.   oBrw:bSkip     = { | nSkip, nDo | nDo := nRel, nRel += nSkip,;
  56.                        nRel := Max( 1, Min( nRel, 8 ) ),;
  57.                        nRel - nDo }
  58.  
  59.   oWndRel:SetControl( oBrw )
  60.  
  61.   ACTIVATE WINDOW oWndRel ;
  62.      VALID ( DeleteObject( hBmpThis ), .t. )
  63.  
  64. return nil
  65.  
  66. //----------------------------------------------------------------------------//
  67.