Difference between revisions of "Listboxes"

From Team Developer SqlWindows Wiki
Jump to: navigation, search
(New page: This page covers listbox tips & tricks. __TOC__ <br> <h2 style="margin:0;background-color:#ddcef2;font-size:120%;font-weight:bold;border:1px solid #afa3bf;text-align:left;color:#000;padd...)
 
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
This page covers listbox tips & tricks.
+
{{PageHeader|ListBox}}
 +
 
  
 
__TOC__
 
__TOC__
<br>
 
  
<h2 style="margin:0;background-color:#ddcef2;font-size:120%;font-weight:bold;border:1px solid #afa3bf;text-align:left;color:#000;padding:0.2em 0.4em;">[[Image:Pointer.png]]Enter new tip title here</h2>
+
 
Enter new tip description here
+
<!------------------------------------------------------------------------------------------------------------------------------>
 +
{{TipHeader|How to force/set listbox horizontal scrollbar width}}
 +
When inserting text into a listbox, the horizontal scrollbar is automatically shown when the text is larger than the listbox width.<br>
 +
You can force the horizontal scrollbar to be shown and set the scrollbar width in pixels or you can force to hide the scrollbar.<br>
 +
When setting the width to a larger value than the largest text in the listbox, you can force empty space after the largest text item.<br>
 +
When setting the width to a smaller value, the text will be truncated.<br>
 +
 
 +
 
 +
When inserting new items to the listbox, the scrollbar width will be reset dynamically when the text is larger than the current scrollbar width.<br>
 +
You can also get the current scrollbar width.<br>
 +
For this to work, you will have to set the listbox attribute '''Horizontal Scroll''' to '''Yes'''.<br>
 +
 
 +
 
 +
First define these constants
 +
 
 +
<pre>
 +
Number: LB_GETHORIZONTALEXTENT    = 0x0193
 +
Number: LB_SETHORIZONTALEXTENT    = 0x0194
 +
</pre>
 +
 
 +
Now, here the code to set and get the scrollbar width:
 +
<pre>
 +
  ! Set the width to 500 pixels
 +
  Call SalSendMsg( lbTest, LB_SETHORIZONTALEXTENT, 500, 0 )
 +
  ! Get the width
 +
  Set nWidth = SalSendMsg( lbTest, LB_GETHORIZONTALEXTENT, 0, 0 )
 +
</pre>
 +
 
 +
Here you can download a sample:<br>
 +
{{Download
 +
|URL=http://samples.tdcommunity.net/index.php?dir=&file=WIKI_ForceListboxScrollbar.zip
 +
|TEXT=WIKI_ForceListboxScrollbar.zip
 +
}}
 +
 
 +
 
 +
 
 +
 
 +
[[Category:Child Objects]]

Latest revision as of 10:51, 29 October 2013

ListBox


Contents


Pointer2.png How to force/set listbox horizontal scrollbar width Pointer.png

When inserting text into a listbox, the horizontal scrollbar is automatically shown when the text is larger than the listbox width.
You can force the horizontal scrollbar to be shown and set the scrollbar width in pixels or you can force to hide the scrollbar.
When setting the width to a larger value than the largest text in the listbox, you can force empty space after the largest text item.
When setting the width to a smaller value, the text will be truncated.


When inserting new items to the listbox, the scrollbar width will be reset dynamically when the text is larger than the current scrollbar width.
You can also get the current scrollbar width.
For this to work, you will have to set the listbox attribute Horizontal Scroll to Yes.


First define these constants

Number: LB_GETHORIZONTALEXTENT    = 0x0193
Number: LB_SETHORIZONTALEXTENT    = 0x0194

Now, here the code to set and get the scrollbar width:

   ! Set the width to 500 pixels
   Call SalSendMsg( lbTest, LB_SETHORIZONTALEXTENT, 500, 0 )
   ! Get the width
   Set nWidth = SalSendMsg( lbTest, LB_GETHORIZONTALEXTENT, 0, 0 )

Here you can download a sample:
Down.png WIKI_ForceListboxScrollbar.zip