OrgChartDlg Organization Chart DEMO Form15 ABCEvents OptionsBtn Options... CancelBtn Cancel OrgChartBrowse CommonDialog *.txt !Choose ASCII Text File for Import *.txt BrowseBtn Browse... OKBtn OrgChartTextFileEdit MS Sans Serif Line6 Line5 Line4 Line3 Line2 Line1 Label1 ASCII Text File: Text1_Change Chart< Object ActiveChart ClearGuidelines NumGuidesT start AddHorizontalGuidelinex Form_Load Text1 Text# Command1_Click> Label1_Click! Command2_Click CMDialog1 Action} OrgChartBrowse OrgChartTextFileEdit OrgChartTextFileEdit_Change BrowseBtn_Click CancelBtn_Click OKBtn_Click Filename$ OrgChartDlg DoCreateOrgChartU success variableK OrgItemh TheChartx ABCChartk Create^ ABCAppl DrawShape TestShape ABCObject EntireFile len_file6 DrawDirection( DrawPositionX DrawPositionY test_charP cur_pos len_strY [Refresh]k are_we_doneb TheCh[ line_break last_rank ShapeStacks index ur_pos! DrawLine6 2[DrawLine(ShapeStack(index-1), ShapeStack(index))] DrawPosition fromShape toShape newlineC DrawSpacingY= FillColor BasicColor ShadowStyle_ Color: DestArrowStyle StemStyleF StemWidth# BorderWidthi Shape+ [newline.Line.Color]E [Line.Color] Line_ FormatOrgString7 OrgString state in_quotes# test_ascCode commaa FormattedStr GetNumLines test_str in_line_feedS total_lines req_objs4 ShapeList ParentList FirstChildList NextSiblingListC cur_obj_count cur_oindexN ShapeRefStack ParentRefList FirstChildRefList| NextSiblingRefList extSiblingRefListt FirstChil CurrentLineType DrawK herer EndFor GetReqSize float fwidth sizeT size_neededz parent RelationMap_ first_child next_sibling Relation8 cur_obj$ OrgGetReqBranchSize relation_mapo size_stack cur_child7 ShapeRefStac RightC box_spacing counter finished? Width level temp_objref posY\ CenterX CenterYM ShapeLi SrcArrowStyle YELLOW BorderColord LabelShown SourceArrowStyle OptionsBtn_Click OrgChartOptionsDlgh OrgChartN Disable Repaint CurrentLineRouting NumberShown DrawLineToOneObject. TestLiney Paint RePain NoRepaint FitToText FitShapeToText size_cx size_cy' Bottom box_spacing_x box_spacing_y size_level size_branchq box_spacing_peers box_spacing_levels HeightC Form_UnloadC Cancel BoxSpacing4 vertical TopToBottomRBtn Value! BottomToTopRBtn reverse RightToLeftRBtnq Esle- inverted Boolean mirrorX\ mirrorY num_levels hapeListL sizes work& according} obj_size_level4 EqualWithinLevels{ IncreaseMgrSize Visible CurrentShapePalette CurrentShape Types PageLayouy Orientation PageLayout MasterItems" Hideall^ PercentGuage PercentGaugeValue DrawnCount HidePercentGauge PercentGauge ShapePaletteVisible PercentGaugeCancelled_ GetClientRectr hwndParent lpPercent m_hwndPercent RxCreateDialog GETINSTANCEt LPSTR MAKEINTRESOURCE> DB_PERCENTGUAGE DlgProc7 Percent TotalFormatIter FormatItere status LoopIter TotalFormat NewGaugeIter@ NewGaugeLoop IntergerW CalcPercent iteger OrghartTextFileEdit Form1 WindowState^ CalcPerentv DoCreateAbort DoCreteAbortW Form_LinkClose BottomToTopRBt Enabled Active MakeActiveO ValidateFilename CaLLValidateFilename OKBtn InitDir Unloadi DataFilename RegisterEvent APPNAME bFailed CHARTTYPE ChartTypeShutdown ABC1_DoubleClickSUBCLASS ABC1_AppQuitNOTIFYX ABC1_AppQuitNOTIFY BrowseBtn_Click OrgChartBrowse.Filename = OrgChartTextFileEdit.Text *.txt CalcPercent CancelBtn_Click Command2_Click DoCreateOrgChart Make a new chartA Set the right shape palette Standard Chart.CurrentShape = "Process" Set the Chart's internal type PROCESS Turn off master items Set up the progess barD ABC.PercentGauge "Organization Chart DEMO", "PASS 1 of 2: Reading & parsing file..." Process update status bar Give all the shapes some attributes here ABC.PercentGauge "Organization Chart DEMO", "PASS 2 of 2: Formatting chart..." There are currently five iterations of formatting We need to go through the list and make sure the sizes work according to the Options Dlge Here we traverse the tree gathering the maximum size box in each level update status bar Now we have to adjust if the manager's size increases. Reinitialize the loop vars Here we traverse the tree gathering the maximum size box in each level update status bar The object has to be at least as big as the biggest on the next leveln Format the chart *here*G start at the top (the "God" object) Dim vertical As Integer Dim inverted As Integer We're just calculating the sizes that these shapes need so far.. update status bar I'll have to admit - this is a little hard to follow - but it's BASIC you know, Visual or notn Can't do too much about the recursion stuff in BASIC This is recursion in disguise Don't be confused-> X and Y are reversed if this is not vertical update status bar since we're skipping an object in this loop Form_Load ABCFlow.application \ORGCHRT1.TXT ABC.RegisterEvent ABC1.VBX, APPNAME, "AppQuitNOTIFY" Form_Unload FormatOrgString comma GetNumLines NewGaugeLoop OKBtn_Click iconize form1 OptionsBtn_Click OrgChartTextFileEdit_Change ValidateFilename