TScrollBar TRect issue #203
Replies: 2 comments 6 replies
|
Can you share more code? For example, the whole initialization code of your dialog? (except for the TListBox items) |
|
Okay. This problem occurs because you use the Unlike other views, tvision/source/tvision/tscrlbar.cpp Lines 47 to 56 in 85aaeca This means that calling The solution is to set an appropiate --- a/TurboVisionTest/formeditable.cpp
+++ b/TurboVisionTest/formeditable.cpp
@@ -86,6 +86,7 @@ void FormEditable::buildForm(FieldsDlg reg, const char *title)
// listBox = new TListBox(TRect(maxLengthLabel+4, y, UIlx-3,std::min(y+numRows,desktopLy-8)),2,0);
vScrollBar = new TScrollBar(rectScrollBar);
+ vScrollBar->growMode = 0; // Do not allow the TScrollBar to be enlarged by 'growTo()'.
listBox = new TListBox(rectListBox,1,vScrollBar);Besides this, you should consider using the --- a/TurboVisionTest/formeditable.cpp
+++ b/TurboVisionTest/formeditable.cpp
@@ -35,7 +35,7 @@ void FormEditable::buildForm(FieldsDlg reg, const char *title)
//get max lengths
for (const FormArgs *ithem:reg)
{
- maxLengthLabel = std::max(maxLengthLabel, (ushort)ithem->labeltext.length());
+ maxLengthLabel = std::max(maxLengthLabel, (ushort)strwidth(ithem->labeltext));
maxLengthInputLine = std::max(maxLengthInputLine, (ushort)ithem->length);
}
const ushort UIlx = maxLengthLabel + maxLengthInputLine + 9;
@@ -46,7 +46,7 @@ void FormEditable::buildForm(FieldsDlg reg, const char *title)
for (FormArgs *ithem:reg)
{
- TStaticText *label = new TStaticText(TRect(maxLengthLabel + 2 - ithem->labeltext.length(), y,
+ TStaticText *label = new TStaticText(TRect(maxLengthLabel + 2 - strwidth(ithem->labeltext), y,
maxLengthLabel + 2, y+1), ithem->labeltext);
this->dlg->insert(label); |
Uh oh!
There was an error while loading. Please reload this page.
This is the TRect i pass to the TListBox constructor, listBox = new TListBox(rectListBox,1,vScrollBar);
TRect rectScrollBar(42, 4, 43, 7);
rectScrollBar.b.y is 7, it shall be 22, and grows a lot when 8 or 10.
What is happening to adjust correctly the TScrollBar to the TListBox?
All reactions