Difference between revisions of "Cocoa Internals/Scroll"

From Lazarus wiki
Jump to navigationJump to search
(Created page with " ==NSScrollView== Cocoa provides a native control, named '''NSSrollView''' to implement scrolling. Cocoa-WS sub-classes the with '''TCocoaScrollView''' class. However, NSScro...")
 
Line 17: Line 17:
  
 
Changing the position of the scroll bar doesn't affect the contents of the view directly (unlike with NSScrollView). Instead a notification is sent to the LCL control and it should properly respond to it (by redrawing its contents).
 
Changing the position of the scroll bar doesn't affect the contents of the view directly (unlike with NSScrollView). Instead a notification is sent to the LCL control and it should properly respond to it (by redrawing its contents).
 +
==TCocoaManualScrollHost==
 +
The is a descendant from TCocoaScrollView. The intent of control is to embed '''TCocoaManualScrollView''' and be able to provide a system-native border {{MantisLink|34761}}.
 +
 
==See Also==
 
==See Also==
 
* [[Cocoa Internals]]
 
* [[Cocoa Internals]]
 
[[Category:Cocoa]]
 
[[Category:Cocoa]]

Revision as of 22:57, 14 August 2019

NSScrollView

Cocoa provides a native control, named NSSrollView to implement scrolling. Cocoa-WS sub-classes the with TCocoaScrollView class.

However, NSScrollView is designed to work strictly of the child control (documentView) size. (similar to TScrollBox)

Thus NSScrollView cannot be used to implement scrolling for CustomControls, where custom scroll settings could be used. (For example SynEdit is using lines for vertical scrolls, not pixels)

Instead, NSScrollView is used for standard controls, such as TListBox and TMemo to implement scrolling. For those controls, direct control of the scrolling Range via SetScrollInfo() might not work all. Though setting a scroller position would still work.

TCocoaManualScrollView

This is an additional view that was introduced to satisfy LCL requirements. (depsite of it's name, there's no NSManualScrollView in Cocoa).

The view provides a basic API to add scrollbars for a view. Showing or hiding scroll bars would adjust the content of the view accordingly (by resizing/redrawing its client rectangle)

Changing the position of the scroll bar doesn't affect the contents of the view directly (unlike with NSScrollView). Instead a notification is sent to the LCL control and it should properly respond to it (by redrawing its contents).

TCocoaManualScrollHost

The is a descendant from TCocoaScrollView. The intent of control is to embed TCocoaManualScrollView and be able to provide a system-native border Issue #34761.

See Also