4DToday.com
Transax Payment Processing for 4D
Home Directory Classifieds Reference Archives
Site Info
About 4DToday.com
Contact Us
Version française
Quote
Developers (720)
4D Developers (589)
Web Developers (333)
Tools Publishers (193)
Instructors (163)
Web Hosts (58)
Resellers (87)
Software Publishers (295)
Search Developers
Products (381)
Plug-Ins (111)
Components (47)
Code Libraries (9)
Books (7)
Tools (42)
Vertical Applications (144)
Search Products
User Groups
All User Groups (22)
Classified Ads (16)
Help Wanted (3)
Opportunities Wanted (9)
Hardware Wanted (0)
Hardware for Sale (0)
Software Wanted (1)
Software for Sale (0)
Other (1)
Resources
4D
4D, Inc.
4D Forum
4D Partner Central
4D Doc Centre
4D Resources
4D BugDisplayer
4D, Inc. Training
Message Lists
4D Mailing Lists
4D Tech Google Group
iNUG Archives (Nabble)
iNUG Archives (Gmane)
iNUG Message Index
Other
4D Code Exchange
4D Resources
Sviluppo4D.it (Italy)
4D Sources (4D Plugin API, 4D Pop & Miyako)
Quote
A man's ethical behavior should be based effectually on sympathy, education, and social ties; no religious basis is necessary. Man would indeed be in a poor way if he had to be restrained by fear and punishment and hope of reward after death. It is therefore easy to see why the Churches have always fought science and persecuted its devotees.
Albert Einstein  
  Suggest a Quote  
[ANN] 4D CAD 1.4.9
Microbizz has released version 1.4.9 of 4D CAD  Would you like to know more? Friday
 Submit Future News    Archive 
Technical Tip
Generic Listbox print routine
Submitted by Keith Culotta, Computer Dimensions, Inc.

// ----------------------------------------------------
  // Method: PrintOutBox - 4D v12.2
  // Description - Prints a selection based listbox by "copying" it to a
  // Description - listbox named "OPBox" on a printing form named "outPrint".
  // Description - OPBox starts out selection based (any Table will do) and has no columns.
  // Description - This example uses the font settings of OPBox.
  //
  // INPUT1: Pointer - to the listbox you would like to print
  // OUTPUT:
  // ----------------------------------------------------


C_POINTER($1;$SourceBox)
$SourceBox:=$1
PAGE SETUP("outPrint") // has a listbox named "OPBox" of no particular height or width
PRINT SETTINGS

If (OK=1)  // Get info about the source listbox
  C_LONGINT($vLBTableNum;$vLBWidth;$size;$i;$vLBHeight)
  ARRAY TEXT($aColNames;0)
  ARRAY TEXT($aHeaderNames;0)
  ARRAY POINTER($aColVars;0)
  ARRAY POINTER($aHeaderVars;0)
  ARRAY BOOLEAN($aVisible;0)
  ARRAY POINTER($aStyles;0)
  C_BOOLEAN($TotallyPrinted)
  
  LISTBOX GET ARRAYS($SourceBox->;$aColNames;$aHeaderNames;$aColVars;$aHeaderVars;$aVisible;$aStyles)
  $size:=Size of array($aColNames)
  ARRAY LONGINT($aColWidth;$size)
  ARRAY TEXT($aHeaderText;$size)
  
  $vLBWidth:=0
  For ($i;1;$size)
  $aColWidth{$i}:=LISTBOX Get column width($aHeaderVars{$i}->)
  $vLBWidth:=$vLBWidth+$aColWidth{$i}
  $aHeaderText{$i}:=OBJECT Get title($aHeaderVars{$i}->)
  End for
  
  LISTBOX GET TABLE SOURCE($SourceBox->;$vLBTableNum)
  
  OPEN PRINTING JOB
  OPEN PRINTING FORM("outPrint")
  
   //  adjust OPBox's size to the User's Print Settings
  SET PRINTABLE MARGIN(0;0;0;0)
  GET PRINTABLE AREA($vLBHeight)
  OBJECT MOVE(OPBox;0;0;$vLBWidth;$vLBHeight;*)  // note that the box can be set wider than the paper
  
  LISTBOX SET TABLE SOURCE(OPBox;$vLBTableNum)
  
    // Set up OPBox to look like the source listbox
  $size:=Size of array($aColNames)
  For ($i;1;$size)
    If ($aVisible{$i})  // don't print invisible columns
      $vLBWidth:=LISTBOX Get number of columns(OPBox)+1
      LISTBOX INSERT COLUMN(OPBox;$vLBWidth;$aColNames{$i};$aColVars{$i}->;$aHeaderNames{$i};$aHeaderVars{$i}->)
      LISTBOX SET COLUMN WIDTH($aHeaderVars{$i}->;$aColWidth{$i})
      OBJECT SET TITLE($aHeaderVars{$i}->;$aHeaderText{$i})
    End if
  End for
  
    // and print
  Repeat
    $TotallyPrinted:=Print object(OPBox)
    If (Not($TotallyPrinted))
      PAGE BREAK
    End if
  Until ($TotallyPrinted)
  
  CLOSE PRINTING JOB
  
End if
  Submit a Tip    Archive 
Spotlight
Lightning
Lightning Develop powerful, professional quality 4D web applications fast, in record time, with minimal costs. Try it now for free.
  Suggest a Spotlight  
Events
There are no events scheduled for the upcoming week.
  Submit an Event