CanvasGlobals

From Jeremie Leroy - XOJO Controls Wiki
Jump to: navigation, search




Properties
StandardCursor




Info

ScrollCanvas version 1.1 A scrollable and zoomable canvas

Version history

1.1 08 Jan 2012


1.0 13 Apr 2011


0.8 06 Jan 2009

--

Known Issues: The SelectionBox flickers a bit. This is due to difficult handling of declares. But i'm still working on it


send comments, suggestions, fixes to lej78480 [@] hotmail.com Use in whatever way you like... at your own risk, no warranties! :P let me know if you find it useful.

License: Please, Do NOT distribute unlocked copies of the source. This control is licensed under the Creative Commons Attribution License. That is to say, anybody can use my work for any reason, I only ask that you give me credit where credit is due (About window or documentation). Also, if you make any changes/improvements please send them to me so I can make them available to the public.

Thank you.

Special Thanks: Alex RESTREPO (CustomEditField) His code helped me alot to create this custom control

Docs

                                                    • Global Settings:

Background: If True, it will draw grey and white squares when there is no picture, or the control is higher/larger than the picture

kHeight: the first letter of "height" word of the language the user has kWidth: the first letter of "width" word...

kWideZoom

kVersion: the current version of the ScrollCanvas, in case you need it...


Centers the view on the current selection if there is one. Else doesn't do anything. If the scrollbars are set, they will be automatically moved. Else, ChangeScroll is raised.

    • GetSelection(value As Integer)

Gets the previous or next selection that was created by the user. Up to 10 selections are stored value>0: the next selection is shown value<0: the previous selection is shown

    • LoadZoom(WideZoom As Boolean = False)

Loads kZoom constant or kWideZoom constant in the list of different zoom values.

    • Save(toFile As FolderItem, Format As Integer = 0) As Boolean

Saves the picture to the FolderItem passed as parameter. See the Notes section of FolderItem in REALBasic for a description of the possible values of Format. If save is successful then returns True.

                                                                                                        • changeZoom

Parameters: Zstep As integer Zstep>0: the zoom gets bigger Zstep<0: the zoom gets smaller

                                                                                                        • changeZoom


                                                                                                        • Events:

ChangeScroll as Boolean Only used if you didn't set the scrollbars with SetScrollbars(horizontal, vertical)

MouseDown, MouseDrag, MouseMove, MouseUp(X As Integer, Y As Integer, RelX As Integer, RelY As Integer) X and Y are the position of the cursor. RelX, RelY are the relative position of the cursor on the picture (zoom and scrollbars values are applied)

Refreshed Raised when the control has refreshed its contents

SelChanged(X1 As integer, Y1 As Integer, X2 As Integer, Y2 As Integer) The Selection box has changed size or position. The Parameters are the corner coordinates for top left and bottom right corners

ZoomChanged(ZoomValue As integer) Raised when the value of Zoom is changed


                                                                                                        • Methods: