` Greenbar a browse (Russ Eggen ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Greenbar a browse
1999-12-21 -- Russ Eggen
 
Go the list box extensions, select the Class tab. Check the derived box. Press the enabled "New class methods" button. Click insert and type the name of your method. Can be any name, and since you are doing a greenbar effect, lets call it "GreenBar". The prototype is (). Click on the Code embed and use code similar to the following (this colors only one column, but I left the BEGIN/END pair in so you can use it for more columns. Also, this assumes a customer list): LOOP X# = 1 TO Records(SELF.Q) !Loop through entire queue GET(SELF.Q,X#) !Read an entry Assert(~ ErrorCode()) !Should be no errors EXECUTE (X# % 2) + 1 !Execute based on modulus math (1 or 2) BEGIN !If odd numbered line, change the colors SELF.Q.CUS:CompanyName_NormalBG = COLOR:Silver !other columns here END BEGIN !If even line, don't change the colors SELF.Q.CUS:CompanyName_NormalBG = COLOR:None !other columns here END END PUT(SELF.Q) !Write back to queue Assert(~ ErrorCode()) !Should not be any errors, so check for one END Jason Austin adds: Hey Russell, that seems a lot of work for a lazy programmer - why not let the existing templates do the work for you without embeds ? (Seem to recall someone telling me that in a class somewhere ) In the list box formatter - check the color box for the fields to be conditionally changed. - on the appearance tab set one of the colors wanted Go to Extensions/Color. There you will see the fields that had the color box checked. Select each of those fields and - set the condition as POINTER(QUEUE:BROWSE:1) % 2 = 0 - set the color to the second color wanted. That's all. Then in the embed Control Events/Browse:1/NewSelection add one line of code: BRW1.GreenBar !or whatever the name of the object is - renamed on the Class tab. One more event: Control Events/Browse:1/ScrollDrag POST(EVENT:NewSelection,?Browse:1) !Make sure scroll drag fires GreenBar This code works with page loaded and file loaded list boxes and you have just written a new method within the IDE. The templates will take care of the rest of the OOP structures. Screams for a template, doesn't it?


Today is April 27, 2024, 6:12 pm
This article has been viewed 35110 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: