Anthoni Posted September 21, 2014 Share Posted September 21, 2014 Hi, I am trying to display some information to the user (a list of Youtube videos to be precise) and I want to display the Thumbnail as well. How do I get the picture displayed in a UniDBGrid? I thought, originally about creating a Frame and placing a normal UniImage on there and then displaying that BUT then I realized I needed to be able to actually allow the user to sort. Hence the Grid Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted September 21, 2014 Administrators Share Posted September 21, 2014 UniDBImage? Quote Link to comment Share on other sites More sharing options...
Anthoni Posted September 21, 2014 Author Share Posted September 21, 2014 UniDBImage? OK, so I might not fully understand, or explained myself properly. I am grabbing the Youtube information via their API system, performing some calculations and then storing the results in a Generic List. The list contains TYoutubeResults class and in that class I have a property called ThumbURL which is a string to the thumbnail of said video. Now in order to show this in a DBGrid I am aware I need to populate a DBMemTable and then add that as Datasource for the DBGrid, however given that the URL is only a string, how do I tell it to display (fetch the image) instead of displaying a string? Hopefully that's explained it a bit better Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted September 21, 2014 Administrators Share Posted September 21, 2014 There are events which will enable you to do this. Please db image demo. Quote Link to comment Share on other sites More sharing options...
Anthoni Posted September 21, 2014 Author Share Posted September 21, 2014 There are events which will enable you to do this. Please db image demo. I don't have that demo listed. I have DBDemo but that is from a Datasource and Blobs Can you send me it please, or attach it here. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted September 21, 2014 Administrators Share Posted September 21, 2014 Grid image demo or something like that Quote Link to comment Share on other sites More sharing options...
zilav Posted September 22, 2014 Share Posted September 22, 2014 however given that the URL is only a string, how do I tell it to display (fetch the image) instead of displaying a string? Create calculated widestring field, and use html tags DataSet.FieldByName('calc_youtube').AsString := Format('<img src="%s">', [DataSet.FieldByName('youtube_url').AsString]); Quote Link to comment Share on other sites More sharing options...
Anthoni Posted September 22, 2014 Author Share Posted September 22, 2014 Create calculated widestring field, and use html tags DataSet.FieldByName('calc_youtube').AsString := Format('<img src="%s">', [DataSet.FieldByName('youtube_url').AsString]); Would I still use the DBGrid FieldImageURL event ? Basically I am not 100% sure where to put that code. Quote Link to comment Share on other sites More sharing options...
zilav Posted September 22, 2014 Share Posted September 22, 2014 Nope. You put it in CalcFields event of DataSet. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted September 22, 2014 Administrators Share Posted September 22, 2014 FieldImageURL is enough. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.