4DToday.com
Home Directory Classifieds Reference Archives
Site Info
About 4DToday.com
Contact Us
Version française
Quote
Developers (724)
4D Developers (591)
Web Developers (334)
Tools Publishers (201)
Instructors (166)
Web Hosts (59)
Resellers (91)
Software Publishers (300)
Search Developers
Products (384)
Plug-Ins (104)
Components (48)
Code Libraries (8)
Books (8)
Tools (42)
Vertical Applications (149)
Search Products
User Groups
All User Groups (23)
Classified Ads (10)
Help Wanted (3)
Opportunities Wanted (5)
Hardware Wanted (0)
Hardware for Sale (0)
Software Wanted (0)
Software for Sale (0)
Other (2)
Resources
4D
4D, Inc.
4D International
4D Wiki
4D Partner Central
4D Beginner's Center
4D Online Documentation
4D 2004 Example Applications
4D Example Databases
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
Many an opportunity is lost because a man is out looking for four-leaf clovers.
Anonymous  
  Suggest a Quote  
4D v15.2 and 4D v14.5 ready for download
We are pleased to announce the availability of the latest maintenance releases for the 4D v15 and v14 product lines: 4D v15.2 and 4D v14.5.  Would you like to know more? Wednesday
 Submit Future News    Archive 
Technical Tip
Table and Related One field popup
Submitted by Keith Culotta, Computer Dimensions, Inc.

  // ----------------------------------------------------
  // Method: popup_MenuFromTablePtr - all menu levels
  // --- Create a Dynamic popup menu with Related One fields & get user's selection
  // INPUT1: Pointer - table of origination
  // OUTPUT:  Pointer - to a field
  // ---------------------------------------------------- 
  // --- params passed from this method to itself
  // INPUT2: Pointer - table to build menu for
  // INPUT3: Pointer - array of built menuRef 
  // INPUT4: menuref - attach new menu to 


C_POINTER($tableOrig;$1;$tableWork;$2;$3;$0;$aMenuPtr)
C_LONGINT($tableNum;$oneF;$oneT;$size)
C_LONGINT($ans;$tn;$fn;$i)

C_TEXT($passedMenu;$4;$newMenu;$fieldName)
C_BOOLEAN($go)

If (Count parameters>0)

$tableOrig:=$1
If (Count parameters=1)
$tableWork:=$1
ARRAY TEXT($aMenus;0)
$aMenuPtr:=(->$aMenus)
$passedMenu:=Create menu
$go:=True
$topLevel:=True
Else 
$tableWork:=$2
$aMenuPtr:=$3
$passedMenu:=$4
$go:=($tableOrig#$tableWork)  // - check for circular ref
$topLevel:=False
End if 

APPEND TO ARRAY($aMenuPtr->;$passedMenu)

If ($go)
$tableNum:=Table($tableWork)
GET FIELD TITLES($tableWork->;$afT;$afN)  // omits invisibles
$size:=Size of array($afN)
SORT ARRAY($afT;$afN)

For ($i;1;$size)

GET RELATION PROPERTIES($tableNum;$afN{$i};$oneT;$oneF)
$fieldName:=Field name($tableNum;$afN{$i})

If ($oneT=0)
APPEND MENU ITEM($passedMenu;$fieldName)
SET MENU ITEM PARAMETER($passedMenu;-1;String($tableNum)+" "+String($afN{$i}))
Else 
$newMenu:=Create menu
popup_MenuFromTablePtr ($tableOrig;Table($oneT);$aMenuPtr;$newMenu)
APPEND MENU ITEM($passedMenu;$fieldName;$newMenu)
End if 

End for 

If ($topLevel)

$ans:=Dynamic pop up menu($passedMenu)

For ($i;1;Size of array($aMenus))
RELEASE MENU($aMenus{$i})
End for 

If ($ans#"")
ARRAY TEXT($aWords;0)
GET TEXT KEYWORDS($ans;$aWords)
$tn:=Num($aWords{1})
$fn:=Num($aWords{2})
$0:=Field($tn;$fn)
End if 

End if 

End if 

End if 
  Submit a Tip    Archive 
Spotlight
4D Job Wallet
4D Job Wallet 4D Job Wallet - a brand new commercial component for 4D developers which is designed to turn method browsing into a breeze, code sharing into a snap and complexity management into fun.
  Suggest a Spotlight  
Survey Question
This weekend, we ask you...
Still working on survey, please vote for debugging purposes...
How/what do you charge?
$75/hr
$100/hr
$125/hr
$150+/hr
Fixed Price
Annual Retainer

Survey submitted by David Eddy
  Show Results (no vote)    Suggest a Survey  
Events
There are no events scheduled for the upcoming fortnight.
  Submit an Event