William Hindman
wdhindman at dejpolsystems.com
Mon Mar 2 20:21:17 CST 2009
"please do not assume your mother has just joined the discussion list." max ...too late ...jc is already here. William -------------------------------------------------- From: "Denis Sherman" <max.wanadoo at gmail.com> Sent: Monday, March 02, 2009 4:02 PM To: "'Access Developers discussion and problem solving'" <accessd at databaseadvisors.com> Subject: Re: [AccessD] A simple Treeview to edit data. > Thanks for that Drew. There is a lot going on behind the scenes and I > will > need to work through your text below. > The program worked fine although I would like to see the code whereby if > there were multiple entries under the main entries (>1 node) and any one > of > them was clicked then the main node would be ticked. IOW if the nodes > were > all closed up I would see ticks in only those where 1 or more nodes were > selected and no ticks where there were zero sub-node selections. Does > that > make sense? Ticking a sub node would auto-tick the main node and > unticking > it would check to see if there were any other sub-nodes ticked and if not, > then it would untick the parent node. > > Is that possible? > > Max > Ps, sometimes I type so quick that instead of typing Max, it comes out as > Ma. If you see this as coming from Ma, please do not assume your mother > has > just joined the discussion list. > > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka > Sent: 02 March 2009 16:55 > To: Access Developers discussion and problem solving > Subject: [AccessD] A simple Treeview to edit data. > > With the interest shown about treeviews, I decided to whip up another > example this morning. > > > > As you all know, Access is an awesome RAD tool, that allows you to > create very powerful interfaces. When it comes to editing 'system' > data, Treeviews will probably fall short. But where they can really > come in handy (and look pretty cool), is when it comes to editing > 'default' data. > > > > As an example, I have whipped up states.mdb. > http://www.marlow.com/states.zip > > > > To begin with, to deal with the actual data, I used my Data Class > Builder (a VB addon I created a while back). So the State and AllStates > (wouldn't let me save the class name as States...go figure) are classes > that were automatically generated by my Data Class Builder. A quick and > dirty example of data classes (and collection). > > > > Next, I noticed to actually get to the Treeview's custom dialog box (a > window that let's you get to the Treeview's very flexible custom > properties), when you go into the properties of your ActiveX Treeview > control, go to the 'Other' Tab, and click the ... next to Custom. > > > > Now, after you download the example, take a quick look at tblStates. An > ID field, then an Abbreviation, FullName, and InUse fields. I'm sure > most of us have a table like this in one system or another (if not > most). > > > > Let's give our Users a form to edit this information. Check out > frmStates. > > > > Keep in mind, this example database took me about 5 minutes to build. > It's taking longer to write this email then to build this example. > There a quirk that I noticed in testing. One, if you run into a unique > index issue, it errors, something that a little more code could handle. > So just keep that in mind, that this is an example, not a full blown, > ready to go into production system. > > > > When you open frmState, notice that all the records are listed. (And > everything is checked). It lists all the states by full name. If you > expand a node, you get the state's abbreviation. Uncheck either the > fullname or the abbreviation, and both are unchecked, AND the 'InUse' > flag for that state is now set to false in the table. (Or check an > unchecked state, and the reverse happens) Cool, eh? But what if we > want to rename a state..... > > > > Click on a state. (either the full name or it's abbreviation. It > becomes selected (highlighted). Now click on it again. (single > clicks)....and the 'label' goes into Edit mode. Type whatever you want > in that label. (Keep in mind that both the fullname and abbreviation > fields are unique indexes, so you can't make FLORIDA 'MAINE', it'll > choke. But you could rename florida to 'Can't Decide'. <grin>. When > you are done typing in what you want to rename the state too, just hit > enter. It goes out of edit mode....and the new data is saved to the > appropriate field! (Go check the table!). > > > > The InUse is handled by the NodeCheck event for the treeview, and the > field renaming is handled by the AfterLabelEdit event. > > > > There is another really nice advantage to Treeviews, and I've added this > to this example. Sometimes you want the user to be able to resize a > form. And when you have lots of controls on a form, that's a lot of > controls to resize. With the 'all in one' ability of a treeview control > (the ability to handle multiple purposes in the same control), you only > have one control to resize! Resize the frmStates form, and you'll see > it only takes two lines of code to keep that form looking nice, neat, > and uniform! > > > > Drew > > > The information contained in this transmission is intended only for the > person or entity to which it is addressed and may contain II-VI > Proprietary > and/or II-VI Business Sensitive material. If you are not the intended > recipient, please contact the sender immediately and destroy the material > in > its entirety, whether electronic or hard copy. You are notified that any > review, retransmission, copying, disclosure, dissemination, or other use > of, > or taking of any action in reliance upon this information by persons or > entities other than the intended recipient is prohibited. > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >