- This topic has 7 replies, 3 voices, and was last updated 11 years, 10 months ago by DarrenB.
-
AuthorPosts
-
January 6, 2013 at 12:35 pm #35559DarrenBParticipant
Hi Serge,
I apologise if recently I'm asking a lot of questions as I realise you only have so much time to address them…but I'm in the process of trying to finalise a few things with my main app so I can put them to bed and move on! I can delay most of them as they are mostly aesthetic issues…the coding is the hard thing, looks come later 🙂
Anyway, I'm having a few problems with the TsComboBoxEx, I've attached a demo and within the demo is a TsMemo fully describing what I'm trying to do and a few 'issues' I've observed.
The basic question is 'how do i correctly change the Imageindex of an item in the TsComboBoxEx'. I have dynamically loaded the TsComboBoxes as I do in my main app (necessary as state/content changes throughout). You'll see in the demo what I've tried so far.
This is the first demo I've ever uploaded using Delphi…I work alone and have never sent anyone source code only completed exe files so I apologise in advance if I have missed files out…I really, honestly have never done this before!…that comes of working alone!. If I have missed any, let me know which ones and I'll reupload the zip…if I haven't then I've learned something else today 🙂
DelphiXE, Vista64Bit, AC 8.14, Latest Skins
Thanks
Darren
*** EDIT for some reason the OnClick event of sComboBoxEx2 didn't get 'linked' in the demo…please open the properties/events of sComboBoxEx2 and reclick on the OnClick to reassociate it….otherwise it won't seem to do anything when u select an image! Sorry :wacko:
****** EDIT 2 1 Day later, reuploaded demo to fix EDIT above ^^^…attached to post 3
January 7, 2013 at 5:05 am #49796HamiltonParticipantHi Darren,
You code worked fine apart from the custom output paths for the project; once I removed those it compiled OK. However, I cannot repro the problem you describe. I've attached a screen grab of how the app looks for me, it's the same when the app starts as when I leave it for a few minutes. Sorry I can't be of more help.
Regards,
Hamilton
January 7, 2013 at 9:27 am #49801DarrenBParticipantHi Hamilton 🙂
thanks ever so much for replying 🙂 Okay, so when you selected an image from the combobox on the right it correctly updated the one on the left? images and text both? It's just your screen shot only shows the 'initial' state of the project when it's ran so I can't be certain. Also it looks from the screen shot that there's no skin applied to the form there? (scrollbars, form background etc look unskinned?). Did you scroll the memo box down to get a full description of problem…*cough* sorry just double checking lol
Thanks for taking the time to help. Here's what it looks like here. Perhaps I can't see the wood from the trees and have made an obvious error in coding…it happens lol
*************
Form when first run
*************
After about 2-5 seconds
**************
After making 2 changes to items in list, using images on right
I have reuploaded demo…I had not linked click event of comboboxex2 properly….mentioned as an edit in first post, but now hopefully fixed.
Thanks
Darren
BTW Hamilton
Quote:You code worked fine apart from the custom output paths for the project; once I removed those it compiled OK.Never uploaded demos before yesterday…how do I stop that from happening? I don't want anyone to have to edit anything to have to compile app.
A silly question but in your screenshot…those pictures don't actually look like that there do they? The black outlines look horrible, here very smooth…was that just your paint package doing it?
January 7, 2013 at 2:43 pm #49806DarrenBParticipantHoly crap batman!
In my demo app I had this code to update comboboxex1
sComboBoxEx1.ItemsEx[StoredComboBoxEx1ItemIndex].ImageIndex :=
sComboBoxEx2.Itemindex;
sComboBoxEx1.Items[StoredComboBoxEx1ItemIndex] := 'Item ' +
inttostr(StoredComboBoxEx1ItemIndex + 1) + ' Holds Picture ' +
inttostr(sComboBoxEx2.Itemindex + 1) + ' *Changed*';
it wasn't working…text updated…image disappeared :/
purely by chance I thought hang on I'll try
sComboBoxEx1.Items[StoredComboBoxEx1ItemIndex] := 'Item ' +
inttostr(StoredComboBoxEx1ItemIndex + 1) + ' Holds Picture ' +
inttostr(sComboBoxEx2.Itemindex + 1) + ' *Changed*';
sComboBoxEx1.ItemsEx[StoredComboBoxEx1ItemIndex].ImageIndex :=
sComboBoxEx2.Itemindex;
and it works perfect!!!!!! Purely changing the order of update from *Update Image Index* then *Update Text* to the opposite…works!!! Phew cool…weird weird weird. Don't ask cos I don't know lol
January 7, 2013 at 4:13 pm #49809DarrenBParticipantThe correct way to change an image and caption (or just image) of the selected item in a TsComboBoxEx with style csExSimple… as far as I know at the moment anyway.
var
StoreItemIndex : integer;
NewCaption : String;
WhichItemToUpdate : integer;
ChangeToWhatImage : integer;
Begin
ChangeToWhatImage := !!!whatever image number you want to change to within bounds of your imagelist!!!
WhichItemToUpdate := !!!whichever itemindex in comboboxex1 you want to change!!!
NewCaption :='Changed!'; // if you want to change just the image, but leave the caption alone…. set this to scomboboxex1.items[WhichItemToUpdate];
StoreItemIndex := scomboboxex1.itemindex;
scomboboxex1.items[StoreItemIndex] :=NewCaption;
scomboboxex1.itemsex[StoreItemIndex].imageindex := ChangeToWhatImage;
scomboboxex1.itemindex :=StoreItemIndex; /// return itemindex back to where it was
end;
the storing of the itemindex property was necessary as if you try to use the itemindex property explicitly, you will get a Out Of Bounds error (-1)…the first call to update the caption invalidates the itemindex property and returns it to -1.
Works fine here. Hope it helps.
January 7, 2013 at 4:52 pm #49810DarrenBParticipantRe : the drawing artefacts issue and the issue I was having with the comboboxex appearing to try and 'resize' it's items on first display…hopefully other people could see what I meant in the demo.
Anyway, in main app I have solved that issue…for me at least. I have reordered my page control so that in it's initial view state the page it displays is not the page upon which the comboboxex lies. It seems that by doing this, when the user switches over to the page with the comboboxex on it, there are no longer any drawing artefacts and the items are correctly sized.
Despite trying to tweak my initial demo, I could not get rid of the issues with artefacts here on my system. Using this new method, I'm happy to say it appears to have gone away 🙂
you can see the differences 🙂 Anyway, highlighted the top caption bar…image should be displayed there for selected item I think…as this is the default behaviour in the control?
Knocking my problems down one by one in the past few days lol!
January 14, 2013 at 8:37 am #49875SupportKeymasterHello!
Some improvements will be added in the nearest release.
January 14, 2013 at 9:42 am #49881DarrenBParticipant'Support' wrote:Hello!
Some improvements will be added in the nearest release.
Thanks Serge… we point em out.. u fix em or tell us we're wrong…perfect lol 😉
-
AuthorPosts
- You must be logged in to reply to this topic.