Hi.I was trying to find a way for CorelDRAW to show me the sizes of the selected shape, so I've done the following macro, but nothing show's.I was trying to use the OnScreenText, so every time the Selection Changes the value gets updated.
Private Sub GlobalMacroStorage_SelectionChange() Dim sr As ShapeRange Set sr = ActiveSelectionRange Dim t As String t = sr.SizeWidth & " * " & sr.SizeHeight Application.CreateOnScreenText.SetTextAndPosition t, sr.PositionX, sr.PositionY, cdrCenterOnScreenText, 0.5, 0.5 Application.CreateOnScreenText.SetTextColor (RGB(0, 0, 255)) Application.CreateOnScreenText.Show End Sub
Any help would be appreciated.
I don't know what your exact needs are, so this might not be the answer you are looking for, but...
Are you aware that under Options>Workspace>Customization>Commands, you can drag the "Size" Command out onto a Command bar? This is the same Command that is seen on the Property Bar. It shows - and allows the user to change - the selection Width and Height. It automatically updates when the selection changes.
check if "sr" is null
My original ideia is to have a way to show the distance between 2 Selected Shapes (is the current Selection is 2 shapes) to show the distance between the 1st and the 2nd to their margin, using the OnScreenText.
I do have the Property Bar and it shows the current selection size.
I'm sorry if i wasn't much more explicit in the beginning.
Thank you.
That's cool. The "definition of problem" is just part of the process!
I would probably use a non-modal VBA form with text boxes to display the desired information, with the updating of those form controls triggered by the SelectionChange event.
That's how I would - and already do - handle such situations myself. If someone else comes along to describe a better way to do that, then hey, I'll learn something!
That's exacly what i have at the moment, a modal form with 4 labels showing the values.