====================================== FoxPro Developers Network of San Diego ====================================== FoxDev TipsLetter #00-02 January 30, 2000 Website: Editor: ---------------------------------------------------------------------- CONTENTS: * Calendar * Tech Tips: _Resizable Steve Settimi Commenting Continuation Lines Art Bergquist Links to Remember Nick Nikula * Other Stuff: Developer-Speak Matt Jarvis Monster Salaries Steve Settimi The Zombie Kings Victor Stone Consulting Solutions Group * Administrivia ====================================================================== CALENDAR: We alternate meetings between Escondido and Sorrento Mesa. All meetings are at 7:00 pm. ------- FREE STUFF ------- We have a number of great prizes we're going to start raffling off at our meetings. At the February meeting, we'll be raffling off a copy of SQL Server 7. Feb. 2 - Sorrento Mesa ---------------------- Part 1 of 2 Nick Nikula and Steve Settimi are teaming up to give us an overview of VFP Com Objects and VFP Com Objects running on MTS. [I assume MTS is the Metropolitan Transit System. DC] March 1 - Escondido ------------------- Part 2 of 2 - Nick Nikula and Steve Settimi continue with VFP Com Objects and MTS. April 5 - Sorrento Mesa ----------------------- Eric Lendvai will be showing us a tool he uses to export VCX classes to code. Eric has found that PRG based classes run significantly faster than VCX based classes. Of course, designing visual classes in a PRG is difficult. With this tool, you can have the best of both worlds. May 3 - Escondido ----------------- Kristyne McDaniel will be showing us how to implement configurable toolbars. June 7 - Sorrento Mesa ---------------------- Tim Daly will be showing us "more SQL Server stuff, and using the VFP upsizing wizard, along with ADO, and ASP." Escondido meetings are at Bergelectric, 2222 Meyers Avenue. Take the Nordahl exit from Highway 78 (west of I-15). Head South. Right on Meyers Ave, first right past Mission. It's a one-story building on the right (there's no sign). Sorrento Mesa meetings are in the PS Business Center, 6450 Lusk Blvd. From the Lusk Blvd driveway, go straight back to the furthest corner of the rear bldg and park. The conference room is upstairs over the Fitness Center. ====================================================================== TIPS ====================================================================== _RESIZABLE by Steve Settimi _Resizable is a class for resizing the controls on a form when the user resizes the form. To use the class, drag it on to your form. In the form's Resize() method place a reference to the AdjustControls() method of the resize object: Thisform.oResizable.AdjustControls() . The adjustments to the location of each control will only happen when the form resizes, so if your form is already "sized up" at design time, the forms's Resize() method, and hence the oResizable.AdjustControls() method, does not fire when the form instantiates, but will fire when a resize event happens. All dimensions will change relative to their positions on the form. I tested the resizer with all types of objects. There is one exception, the "container" class. Again, no code written in the original class definition to handle it. It would be the same type of code I added for the commandgroup class. I haven't done it for the container class as I haven't yet needed it... essentially a cut n' paste of the other. ************************************************** *-- Class: _resizable (d:\admin\foxdev\_controls.vcx) *-- ParentClass: _custom (d:\admin\foxdev\_base.vcx) *-- BaseClass: custom * DEFINE CLASS _resizable AS _custom Height = 19 Width = 27 *-- Is this the first time the controls are being adjusted? PROTECTED initialresize initialresize = .T. PROTECTED initialformheight initialformheight = 0 PROTECTED initialformwidth initialformwidth = 0 Name = "_resizable" PROTECTED acontrolstats[1,5] *-- Call from resize event of a form to adjust the placement and size of contained objects. PROCEDURE adjustcontrols IF THIS.InitialResize THIS.LoopThroughControls("INITIALIZE_AND_ADJUST") THIS.InitialResize = .F. ELSE THIS.LoopThroughControls("ADJUST") ENDIF ENDPROC PROTECTED PROCEDURE addtoarray LPARAMETERS oControl LOCAL nLen nLen = ALEN(THIS.aControlStats,1) THIS.aControlStats[nLen,1] = oControl.Top / THIS.InitialFormHeight THIS.aControlStats[nLen,2] = oControl.Left / THIS.InitialFormWidth THIS.aControlStats[nLen,3] = oControl.Height / THIS.InitialFormHeight THIS.aControlStats[nLen,4] = oControl.Width / THIS.InitialFormWidth THIS.aControlStats[nLen,5] = IIF(TYPE("oControl.FontSize") = 'U', ; 0, oControl.FontSize) DIMENSION THIS.aControlStats[nLen+1, 5] ENDPROC PROTECTED PROCEDURE setsize LPARAMETERS oControl, nPos oControl.Top = THISFORM.Height * THIS.aControlStats[nPos,1] oControl.Left = THISFORM.Width * THIS.aControlStats[nPos,2] oControl.Width = THISFORM.Width * THIS.aControlStats[nPos,4] IF !oControl.Baseclass $ "Textbox Spinner" oControl.Height = THISFORM.Height * THIS.aControlStats[nPos,3] ENDIF ENDPROC PROTECTED PROCEDURE loopthroughcontrols LPARAMETERS cTask * Valid parameters for cTask are 'Initialize_And_Adjust' and 'Adjust' LOCAL nOldDecimal, nPos, i, j, k, oControl cTask = UPPER(cTask) nOldDecimal = SET("DECIMAL") SET DECIMAL TO 4 #define BASE_CLASS "Commandbutton Combobox Checkbox Listbox Form "; +"Grid Textbox Label Shape Editbox Olecontrol "; +"Pageframe Commandgroup Image Spinner" nPos = 0 THISFORM.LockScreen = .T. FOR m.i = 1 TO THISFORM.ControlCount oControl = THISFORM.Controls[m.i] IF oControl.Baseclass$BASE_CLASS nPos = nPos + 1 DO CASE CASE cTask = 'INITIALIZE_AND_ADJUST' THIS.AddToArray(oControl) THIS.SetSize(oControl, nPos) CASE cTask = 'ADJUST' THIS.SetSize(oControl, nPos) ENDCASE ENDIF *A pageframe can contain only pages IF THISFORM.Controls[m.i].Baseclass$"Pageframe" *Loop through each page of the pageframe FOR m.j = 1 TO THISFORM.Controls[m.i].PageCount WITH THISFORM.Controls[m.i].pages[m.j] *loop through all the controls on the page FOR m.k = 1 TO .ControlCount IF .Controls[m.k].Baseclass$BASE_CLASS nPos = nPos + 1 DO CASE CASE cTask = 'INITIALIZE_AND_ADJUST' THIS.AddToArray(.Controls[m.k]) THIS.SetSize(.Controls[m.k], nPos) CASE cTask = 'ADJUST' THIS.SetSize(.Controls[m.k], nPos) ENDCASE ENDIF ENDFOR ENDWITH ENDFOR ENDIF *!* commandgroup IF THISFORM.Controls[m.i].Baseclass $ "Commandgroup" *Loop through each button of the commangroup FOR m.j = 1 TO THISFORM.Controls[m.i].ButtonCount WITH THISFORM.Controls[m.i].buttons[m.j] IF THISFORM.Controls[m.i].buttons[m.j].Baseclass$BASE_CLASS nPos = nPos + 1 DO CASE CASE cTask = 'INITIALIZE_AND_ADJUST' THIS.AddToArray(THISFORM.Controls[m.i].buttons[m.j]) THIS.SetSize(THISFORM.Controls[m.i].buttons[m.j], nPos) CASE cTask = 'ADJUST' THIS.SetSize(THISFORM.Controls[m.i].buttons[m.j], nPos) ENDCASE ENDIF ENDWITH ENDFOR ENDIF ENDFOR THISFORM.LockScreen = .F. SET DECIMAL TO nOldDecimal ENDPROC *-- Resets the Timer control so that it starts counting from 0. PROCEDURE reset THIS.InitialResize = .T. DIMENSION THIS.aControlStats[1,5] ENDPROC PROCEDURE Init THIS.InitialFormHeight = THISFORM.Height THIS.InitialFormWidth = THISFORM.Width ENDPROC ENDDEFINE * *-- EndDefine: _resizable ************************************************** [Stephen Settimi is an independent developer, and a former Board Member of FPDN.] ---------------------------------------------------------------------- COMMENT CONTINUATION by Art Bergquist You can put in-line comments (i.e., comments after the semi-colon) in VFP 6. For example, Select * ; && Get ALL fields From Customer ; Where State = 'CA' ; && Where I live Into Cursor CA_Customers (Just don't try it from the Command Window; you'll get a "Command contains unrecognized phrase/keyword" error message in which case you simply delete off the side-bar comments to successfully run the SQL-Select from the Command Window.) [And be sure there's no ';' on the final line. DC] [At last - a reasonable way to document an long SQL select! All you folks who started with VFP5 probably know this already, but to those of us who were weaned on 2.x it's a revelation!. DC] [Art works for GE Capital Consulting, and is our Vice-President] *--------------------------------------------------------------------- LINKS TO REMEMBER Nick Nikula Here are some good-to-know URL'S: MSDN Library - Building Three-Tier Client/Server Applications with Visual FoxPro MSDN on line What's New in XML for Microsoft Windows 2000 Microsoft Transaction Server for Visual FoxPro Developers And one of my favorites [Nick Nikula (nee Claude) is the Secretary of FPDN, and a known abuser of SQL, ODBC, ADO, and other abominations. DC] ====================================================================== OTHER STUFF ====================================================================== DEVELOPER-SPEAK Matt Jarvis When it comes to being a developer, I'm not sure which is worse: that we talk like this or that we can understand stuff like this.... "thought the designers were being slick and did a select all with the filter condition becoming the Where clause target, then, creating a cursor with some unintelligible name like _FE102DA3." [commenting on a previous message in the ProFox listserve.] ---------------------------------------------------------------------- MONSTER SALARIES Steve Settimi "Coming to a city near you." Expect to see this type of salary offers in San Diego within the next year: From www.monster.com searched: "foxpro". A job in the bay area:"Salary: $80,000.00 to $95,000.00 per year" [Bye, Steve. Send us a card. DC] ---------------------------------------------------------------------- THE ZOMBIE KINGS Victor Stone from Stone's Way [Bonnie has been asked by Wei, her supervisor, to present her improved module to the regular meeting of the System Architects. She has never met them before, but knows that at least two of them are named Bruce.] Wei quickly introduced Bonnie to everybody -- indeed, three of them were Bruce -- and launched into a thumbnail of the situation, explaining the module that Bonnie was responsible for, sketching out the types of changes she had made. In a professional courtesy, he turned to Bonnie to let her expound on the very positive performance test results. The room went through an almost heart-felt sham of being impressed. "What's the interface like?" asked Bruce number one. "It's the same as it always was; we just added a flag to some of the functions to take the different states into account in a more relevant way," explained Bonnie, wondering where this was going. "Oh, so the interface doesn't comply with CoDEPP?" inquired Bruce number two. "What's a co-dep?" Bonnie asked with concern. To avoid any bumps, Wei jumped in: "CoDEPP is the new architecture, Constituent Design Engineering Pattern Process, that BruceL and BruceW created -- and that the whole company is converging on. I think Bruce is suggesting that we conform the interface of your module to the CoDEPP spec so that your great performance improvements can be shared throughout the company." "Exactly," Bruce number two continued. "That way, you'll be plugged into the Building 7 project." "But my code has no application to the Building 7 project," Bonnie countered with a deeply furrowed brow. "That's right, but if you wrap your stuff in our CoDEPP interface wrapper, they will find an application," chimed in Bruce number three. "If I wrap my code in a generic architecture interface, it will lose the performance gains and introduce more chance of instability, no?" "There might be a slight performance degradation," admitted Bruce number one, "but it's more strategically sound to be aligned with the rest of the company." "Wouldn't it be more strategically sound to have faster, more reliable code?" Bonnie was growing visibly surprised at the course of the conversation. She felt her pulse rise, and she leaned forward slightly to mask her gasping. She didn't need this group's approval, she didn't want this group's approval, and she didn't want to be in the same room as this group. "Oh, and don't forget," said Bruce number three, "she didn't take the 'zombie' state into account." All the Bruces were nodding their heads in agreement. Bonnie looked directly at Wei with a mix of angst and disappointment, but he was heads-down studying something on his yellow legal pad. "What's the 'zombie' state?" "It turns out that when two CoDEPP modules disengage, the shared objects might get dropped in the process," said Bruce number one, with shades of helpful condescension. When your module becomes CoDEPP-enabled, you'll have to take that state into account. Those objects become zombie objects." Bonnie laughed out loud, but quickly caught herself and straightened her expression. Everyone in the room took her laugh to be simply about the term "zombie." However, hearing the architects' definition of the term explained the derivation of the derogatory nickname for the architects' team: "The Zombie Kings," which had never really clicked until now. "So just by wrapping my new code in your slower, buggier, standardized component interface layer, I have to deal with new states as well? What happens to the zombie objects if I don't comply to the interface?" "Whether you comply doesn't make a difference" said Bruce number two. "Part of the design of CoDEPP is that the objects get lost and can't safely be used anymore. Just in case anyone tries to access that part of memory they get a new error code." At that point, he jumped up to the white board and wrote out: E_THIS_MEMORY_INTENTIONALLY_LEFT_BLANK. Bonnie was dumbfounded. "And you wonder why the world hates you?" [Every now and then I like to remind myself why I don't work for large companies any more. DC] ---------------------------------------------------------------------- SOLUTIONS CONSULTING GROUP Solutions Consulting Group, at 6540 Lusk Blvd, is the host for our Sorrento Mesa meetings. But who are they, and what do they do? "Since its inception in 1993, Solutions Consulting Group has grown to more than 40 employees with over 65 active clients throughout Southern California. We are a Microsoft Certified Solution Provider Partner and a member of the Oracle Business Alliance Program." They do: Corporate Application Development Data Warehousing Network Services They work in FoxPro, VFP, VB, Access, SQL, and Oracle. They are looking for more employees and they do use contractors as well; contact Armando Andrade at if you're interested. For More Information... --------------------------Administrivia------------------------------- This newsletter is a service to members of the FoxPro Developers Network of San Diego (FPDN). The editor (Dan Covill) is solely responsible for the content, Barbara Peisch does the distribution. E-mail the editor YOUR tips, comments, complaints, and rebuttals. Editor: Dan Covill 858-272-2448 Board of Directors: Eric Lendvai - President 760-734-4929 Art Bergquist - Vice Pres 760-740-0428 Claude Nikula - Secretary 619-615-6318 Barbara Peisch - Treasurer 760-729-9607 Dan Covill - Director 858-272-2448 Thad V'Soske - Director 619-544-9900 ----------------------------------------------------------------------