fraxzi Posted May 4, 2021 Share Posted May 4, 2021 Hi All, How to do this in dbGrid? I really appreciate it. Thanks in advance. Frances Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 4, 2021 Share Posted May 4, 2021 1 hour ago, fraxzi said: Hello, UniDBGrid -> Columns[xx] -> DisplayMemo = True ? Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 4, 2021 Share Posted May 4, 2021 Hello, You can use HTML in uniDBGrid, just enable and use SQL like this: Select '<H1 style="youre css styles">' + MyColumn + '</H1>' from Mytable Quote Link to comment Share on other sites More sharing options...
fraxzi Posted May 6, 2021 Author Share Posted May 6, 2021 On 5/4/2021 at 1:28 PM, Sherzod said: Hello, UniDBGrid -> Columns[xx] -> DisplayMemo = True ? Hi @Sherzod, I wish to limit the memo to 3 lines ... the 3rd line should display ellipsis "..." if memo is more than 2 lines ... (max line is 50 chars) How can I accomplish? Thanks in advance, Frances Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 6, 2021 Share Posted May 6, 2021 Hello, can this help You: https://sciter.com/forums/topic/how-to-text-overflowellipsis-in-textareareadonly/ use it on Your custom css file. <!DOCTYPE html> <html> <head> <style> textarea { width: 200px; border: 1px solid; padding: 2px 5px; /*resize:none;*/ /* BOTH of the following are required for text-overflow */ white-space: nowrap; overflow: hidden; } .overflow-visible { white-space: initial; } .overflow-clip { text-overflow: clip; } .overflow-ellipsis { text-overflow: ellipsis; } .overflow-string { /* Not supported in most browsers, see the 'Browser compatibility' section below */ text-overflow: " [..]"; } </style> </head> <body> <textarea id="w3review" class="overflow-ellipsis" name="w3review" rows="4" cols="50"> Nulla aliquet gravida nunc sit amet ultrices. Vestibulum ultricies mi eget feugiat aliquet Curabitur placerat tellus vel pulvinar fringilla. Integer dignissim ut sem eget mollis. Aliquam ac tortor in nunc dapibus blandit. Aliquam vehicula diam quis sem consequat </textarea> </body> </html> and explanation in this: https://stackoverflow.com/questions/40921849/text-overflow-ellipsis-not-work-on-textarea аnd here: https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 6, 2021 Share Posted May 6, 2021 On 5/4/2021 at 9:04 AM, fraxzi said: Hello, Also this post can be analyzed: Quote Link to comment Share on other sites More sharing options...
fraxzi Posted May 7, 2021 Author Share Posted May 7, 2021 21 hours ago, irigsoft said: Hello, can this help You: https://sciter.com/forums/topic/how-to-text-overflowellipsis-in-textareareadonly/ use it on Your custom css file. <!DOCTYPE html> <html> <head> <style> textarea { width: 200px; border: 1px solid; padding: 2px 5px; /*resize:none;*/ /* BOTH of the following are required for text-overflow */ white-space: nowrap; overflow: hidden; } .overflow-visible { white-space: initial; } .overflow-clip { text-overflow: clip; } .overflow-ellipsis { text-overflow: ellipsis; } .overflow-string { /* Not supported in most browsers, see the 'Browser compatibility' section below */ text-overflow: " [..]"; } </style> </head> <body> <textarea id="w3review" class="overflow-ellipsis" name="w3review" rows="4" cols="50"> Nulla aliquet gravida nunc sit amet ultrices. Vestibulum ultricies mi eget feugiat aliquet Curabitur placerat tellus vel pulvinar fringilla. Integer dignissim ut sem eget mollis. Aliquam ac tortor in nunc dapibus blandit. Aliquam vehicula diam quis sem consequat </textarea> </body> </html> and explanation in this: https://stackoverflow.com/questions/40921849/text-overflow-ellipsis-not-work-on-textarea аnd here: https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow Hi, This is good for readonly (am I right?).. the memo column should be editable. Thanks. Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 7, 2021 Share Posted May 7, 2021 4 hours ago, fraxzi said: Hi, This is good for readonly (am I right?).. the memo column should be editable. Thanks. Hello, I am not sure ("is good for readonly"), but You can try it. My knowledge in html is not good enough. Quote Link to comment Share on other sites More sharing options...
likemike Posted May 7, 2021 Share Posted May 7, 2021 Hi, My solution is: 1: Put this CSS in servermodule: .x-p-memoww { word-wrap: break-word !important; white-space: pre-line; line-height: 1.2 !important; padding: 2 5 2 5; } 2. Create a new calculated field in your query (e.g. name it "TextMultilines"). 3. use the DatasetCalcField event and put in this code: DataSet.FieldByName('TextMultilines').AsString:='<p class="x-p-memoww">' + DataSet.FieldByName('OriginField').AsString + '</p>'; 4. set the property "AllowHTML" of the new field to true 5. use the new field in your grid If it's absolutely necessary for you to limit the text to 3 line, you have to calculate the html by yourself. In this case you can set aside the css stuff above and as part 3 you have to use something like that: 3. use the DatasetCalcField event and put in this code: DataSet.FieldByName('TextMultilines').AsString:= '<p>' + copy(DataSet.FieldByName('OriginField').AsString,1,30)+'<b>'+ + copy(DataSet.FieldByName('OriginField').AsString,31,30)+'<b>'+ + copy(DataSet.FieldByName('OriginField').AsString,61,30)+'...'+ '</p>'; Of course you have to improve this code to ensure, that words are not divided in the middle of the word. And you have to measure the available width in the grid. 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.