Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / qt / 2007-05

TScrollBar patch

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho
to zeljko

Hi, the patch looks good, but I would like that some things be changed:

* DoTheJob is the typical name that a function shouldn't have (i.e. it doesn't mean anything).

* Also, I think that internal functions should be avoided whenever possible, and particularly in this case I see that it could be avoided. at the point where it is called we only have:

+                   DoTheJob(SB_HORZ);
+                   Result := FScrollInfo.nPos;

for all cases (only in 1 we don't have, but then we could call Exit on it) this is the last thing done, so it could be moved out of the case statement. We can also use a variable to see later if SB_HORZ or something else was selected.

The only problem is that the function would become too big. If another function is really needed I would rather have a private function on TQtWidgetSet class. This will force the function to not use the private variables of the main one, and thus improve it's design.

* Identation:

  case VariableX of
    CONST_A:
    begin
    end;
    CONST_B:
    begin
    end;
  end;

each identation step takes 2 spaces and the begin is on separate line as the constant

Carefully written code means it will be easier to maintain later =)

thanks,

Felipe Monteiro de Carvalho

Reply by email

zeljko
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
Hi, the patch looks good, but I would like that some things be changed:

just apply it, it's already changed this morning, so I can continue.

* DoTheJob is the typical name that a function shouldn't have (i.e. it doesn't mean anything).

yes, I know leave it there at this moment, I'll remove it as soon as I finish SetScrollInfo.

Show quoted text 12 lines
* Also, I think that internal functions should be avoided whenever possible, and particularly in this case I see that it could be avoided. at the point where it is called we only have: + DoTheJob(SB_HORZ); + Result := FScrollInfo.nPos; for all cases (only in 1 we don't have, but then we could call Exit on it) this is the last thing done, so it could be moved out of the case statement. We can also use a variable to see later if SB_HORZ or something else was selected.

you're right but this is an alpha code at the moment , beautification comes at the end :)

Show quoted text 20 lines
The only problem is that the function would become too big. If another function is really needed I would rather have a private function on TQtWidgetSet class. This will force the function to not use the private variables of the main one, and thus improve it's design. * Identation: case VariableX of CONST_A: begin end; CONST_B: begin end; end; each identation step takes 2 spaces and the begin is on separate line as the constant

yes , mom ;)

I'll send new patch this afternoon (Fixed some problems with ScrollBars showing, problem was in calling BoundsRect instead of ClientRect ....)

Reply by email

Felipe Monteiro de Carvalho
to zeljko
zeljko wrote
just apply it, it's already changed this morning, so I can continue. From your point of view it doesn't make any difference, because if I

don't apply it, on your next patch this modifications will appear again too.

So I will opt to wait for your next patch will the information from the last + fixes + new things.

you're right but this is an alpha code at the moment , beautification comes at

the end :)

Ummm .... careful with that. Temporary things have a strong tendency to become permanent.

thanks,

Felipe Monteiro de Carvalho

Reply by email

zeljko
to Felipe Monteiro de Carvalho: Hi, the patch looks good, but I would like that some things be changed: * DoTheJob is the…
Felipe Monteiro de Carvalho wrote
The only problem is that the function would become too big. If another function is really needed I would rather have a private function on TQtWidgetSet class. This will force the function to not use the private variables of the main one, and thus improve it's design.

I've finished those functions, (DoTheJob() renamed to PrepareScrollInfo) and I think that it should stay here , cause only SetScrollInfo() is caller of this function, also the size of SetScrollInfo will not be bigger than it is (maybe few lines more).

New patch is attached, scrollbars works nice, but with one exception, if U enable scrollbars on TScrollingWinControl() (TForm), it'll raise AV. I'll try to fix this next days.

CHANGES:
1.New QAbstractSliderH events added (SlotValueChange, SlotSliderMoved, SlotSliderPressed, SlotSliderReleased, SlotRangeChange) 2.TStringGrid now have fully functional TScrollBar and it becomes to look like a real TStringGrid ;)

cheers,
zeljko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qtupdate-r11216.patch
Type: text/x-diff
Size: 18308 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/qt/attachments/20070529/b23165e2/attachment.bin>

Reply by email