tag:blogger.com,1999:blog-8832291873344926372.post7560221829519642459..comments2024-03-24T14:03:17.111-04:00Comments on Cape Cod Gunny - Michael Riley: Raize Components Makes Id/Value Pair Logic A BreezeMichael Rileyhttp://www.blogger.com/profile/15959746627356186242noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-8832291873344926372.post-66926389557009550052012-08-09T01:50:07.005-04:002012-08-09T01:50:07.005-04:00XCluster the right should be:
if FoundedIndex <...XCluster the right should be:<br /><br />if FoundedIndex <> IndexNotFound then<br />Self.ItemIndex := FoundedIndex<br />else<br />raise Exception.CreateFmt(SItemNotFoundError, [Value]); <br /><br />Regards,<br />Diego GarciaAnonymoushttps://www.blogger.com/profile/00051334293309682217noreply@blogger.comtag:blogger.com,1999:blog-8832291873344926372.post-16855020502398315452012-08-09T00:15:04.846-04:002012-08-09T00:15:04.846-04:00Thanks for the correction xcluster !
I've qui...Thanks for the correction xcluster !<br /><br />I've quick typed the code here :)<br /><br />Regards<br />Diego GarciaAnonymoushttps://www.blogger.com/profile/00051334293309682217noreply@blogger.comtag:blogger.com,1999:blog-8832291873344926372.post-87395444524663926732012-08-08T21:37:12.209-04:002012-08-08T21:37:12.209-04:00I just received an email from Ray Konopka regardin...I just received an email from Ray Konopka regarding the Value property. As it turns out the Value property is a read/write property. So, you can assign a value to the Value property and the ItemIndex will automatically change. How simple is that.<br /><br />RzComboBox1.Value := IntToStr(7);<br /><br />Thanks Ray and keep up the great work.<br /><br />Gunny MikeMichael Rileyhttps://www.blogger.com/profile/15959746627356186242noreply@blogger.comtag:blogger.com,1999:blog-8832291873344926372.post-46828923476355671222012-08-08T16:32:39.144-04:002012-08-08T16:32:39.144-04:00Very nice. As a nice side effect the raize compon...Very nice. As a nice side effect the raize components generally fix a lot of weird glitches that I otherwise experienced in the VCL. A simple example is that the Page Control in regular VCL, which is simply a wrapper for the MS Common Controls library does not override the default painting code for Tabs when they are positioned on the bottom. Since Windows itself does a bad job (paints the tabs the wrong way around), and since the VCL doesn't work around it, you have to add owner-draw code to ALL your page controls if you want them to look okay, on Windows Vista or Windows 7 with the tabs positioned at the bottom. <br /><br />With the Raize page controls (or the Jedi ones, or any other decent tab control), things like this are taken care of for you. And then you can get the funky page/tab shapes that the Raize tab control has. Very nice. <br /><br />Ray Konopka is a super nice guy and has been a member of the Delphi community since forever. Some of the newcomers might not remember that one of his contributions to the community was the first and only book for Delphi focused on component development. It was for a now-ancient delphi version, but remains the definitive work on the subject. Any aspiring delphi hacker must acquire a copy of his book.<br /><br />WWarrenhttps://www.blogger.com/profile/04053407632823479165noreply@blogger.comtag:blogger.com,1999:blog-8832291873344926372.post-5332662548746909122012-08-08T10:39:39.370-04:002012-08-08T10:39:39.370-04:00if FoundedIndex > -1 then
:)if FoundedIndex > -1 then<br />:)xclusterhttps://www.blogger.com/profile/17122908220126397876noreply@blogger.comtag:blogger.com,1999:blog-8832291873344926372.post-49618608787913603092012-08-08T09:22:15.828-04:002012-08-08T09:22:15.828-04:00And this feature does also work in the TRzDbCombob...And this feature does also work in the TRzDbCombobox, where you can have cryptic values in the database and nice verbose text displayed to the user. Very handy whan you want to have a DB combobox showing its items in the current UI language, while the database content keeps unchanged.Uwe Raabehttps://www.blogger.com/profile/08727704609084298159noreply@blogger.comtag:blogger.com,1999:blog-8832291873344926372.post-18986044359869043912012-08-08T09:21:05.662-04:002012-08-08T09:21:05.662-04:00XCluster is right and you could do that in a class...XCluster is right and you could do that in a class helper for the raize component.<br /><br />Something like that:<br /><br /><br /> TRzComboBoxHelper = class helper for TRzComboBox<br /> public<br /> procedure SelectItem(Value: Integer);<br /> end;<br /><br /><br /> procedure TRzComboBoxHelper.SelectItem(Value: Integer);<br /> const<br /> IndexNotFound = -1;<br /> SItemNotFoundError = 'The item "%d" was not found in the list.';<br /> var<br /> FoundedIndex: Integer;<br /> begin<br /> FoundedIndex := Self.IndexOf(Value);<br /> if FoundedIndex = -1 then<br /> Self.ItemIndex := FoundedIndex<br /> else<br /> raise Exception.CreateFmt(SItemNotFoundError, [Value]);<br /> end;<br /><br />Hope it helps :)<br /><br />Regards,<br />Diego GarciaAnonymoushttps://www.blogger.com/profile/00051334293309682217noreply@blogger.comtag:blogger.com,1999:blog-8832291873344926372.post-42365289802308249582012-08-08T07:09:44.038-04:002012-08-08T07:09:44.038-04:00It's shorter :)
cb.ItemIndex := cb.Values.Ind...It's shorter :)<br /><br />cb.ItemIndex := cb.Values.IndexOf(IntToStr(x));<br /><br />but have to know, that if "x" isn't in Values, then cb.ItemIndex will be -1xclusterhttps://www.blogger.com/profile/17122908220126397876noreply@blogger.com