Print Page | Close Window

Canvas GetTop and SetTop

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: MarkupLabel Control
Forum Description: Topics Related to Codejock MarkupLabel Control
URL: http://forum.codejock.com/forum_posts.asp?TID=19616
Printed Date: 27 September 2024 at 10:44am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Canvas GetTop and SetTop
Posted By: Krog
Subject: Canvas GetTop and SetTop
Date Posted: 27 March 2012 at 11:20pm
Hi!

The functions GetTop, GetLeft, GetRight and GetBottom from the MarkupCanvas object class are implemented as methods (sub) instead of functions. So they don't return the values and then they are useless.

And it appears that the methods SetTop, SetLeft... don't work too. At least for me I can't make them to work at run-time.

Any tips?



-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6



Replies:
Posted By: Oleg
Date Posted: 28 March 2012 at 11:07am
Get methods returned void.  Fixed for next relese.  Don't see problem with Set method.  Please write support if try fix.  Give sample on how you use Set so I debug.


Posted By: Krog
Date Posted: 28 March 2012 at 8:09pm
Hi Oleg!

I uploaded a program to test it. I can't move the rectangle and the border inside the canvas using the Set functions.

Here it is:

uploads/3733/TestCanvasSetFunctions.zip - uploads/3733/TestCanvasSetFunctions.zip

Thanks in advance!



-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6


Posted By: Krog
Date Posted: 12 April 2012 at 12:47am
Hi All!

Did someone get to make the Set functions to work?


-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6


Posted By: Krog
Date Posted: 12 April 2012 at 2:56am


Another discovery: when I set a MouseMove event to a Canvas element it only fires the event when the mouse is over a child element, the event is not fired when the mouse is moved over a empty space inside the canvas.

I need these features to make possible to the user to move elements inside a canvas using the mouse, like drag'n'drop.

Here is an example project:
 
http://forum.codejock.com/uploads/3733/TestMarkupMouseCapture.rar - uploads/3733/TestMarkupMouseCapture.rar

When run, hold the mouse left button over some colored border element and then move it vertically. When the mouse is over the border we can move (in this case) the entire label control, but if we move the mouse to the right outside the border, then we can't move it anymore. The MouseMove event is not fired in this case.

The XAML code used can be checked inside the MarkupLabel Caption property.

Having the Set functions working and this event working we can implement this functionality. Hope you can do it.

Thanks in advance!



-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6


Posted By: Krog
Date Posted: 12 April 2012 at 5:12pm
Another related problem:

When we set a Cursor to a parent container (in this case a Border element) we expect that when the mouse is over it the cursor must be the specified one.

But what happens is that the cursor only changes when it is over a child element. If the mouse pointer is over an empty space inside the parent element, the cursor does not changes (and it is expected to change since the property was specified to the parent element).

Here is an example:

<Border Cursor='Hand'>
<Grid><Grid.ColumnDefinitions><ColumnDefinition Width='Auto'/><ColumnDefinition Width='*'/><ColumnDefinition Width='Auto'/></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition/><RowDefinition/></Grid.RowDefinitions>
<Image Grid.RowSpan='2' Width='20' VerticalAlignment='Center' Source='file://AnyTinyImageHere.png '/>
<TextBlock Grid.Column='1' Grid.Row='0' Margin='2, 0, 0, 0' Foreground='#404040'>%name%</TextBlock>
<TextBlock Grid.Column='1' Grid.Row='1' Margin='40, 0, 0, 0' Foreground='#a0a0a0'>%source%</TextBlock>
<Image Grid.Column='2' Grid.RowSpan='2' Width='20' Source='file://AnyTinyImageHere.png'/>
</Grid>
</Border>

In this case, the cursor only changes when the mouse is over any  TextBlock  or image element. If the mouse is above or bellow an image, or at the left of the second TextBlock, it remains the default.



-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6


Posted By: Krog
Date Posted: 12 April 2012 at 5:14pm
I tested now with a Canvas and the result is the same. To test it's only to replace the parent Border with a Canvas.

-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6


Posted By: Krog
Date Posted: 12 April 2012 at 5:37pm
Interestingly, if we set a background on the parent element, it does work!

Changing the parent element to this:

<Border Background='White' Cursor='Hand'>

makes the cursor change to a Hand whenever the mouse is over the parent element.

But, this information is only to help you, since I need a transparent background... :/

Thanks in advance for any reply!


-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6


Posted By: Krog
Date Posted: 12 April 2012 at 6:05pm
There is a lot of flickering in this example, when the mouse is over:

<Page>

<Page.Resources>

        <Style TargetType="Grid">
            <Setter Property="Background" Value="White"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Trigger.Setters>
                        <Setter Property="TextBlock.Visibility" Value="Hidden"/>
                        <Setter Property="Image.Visibility" Value="Visible"/>
                    </Trigger.Setters>
                </Trigger>
            </Style.Triggers>
        </Style>

</Page.Resources>

<Border Cursor='Hand'>
<Grid><Grid.ColumnDefinitions><ColumnDefinition Width='Auto'/><ColumnDefinition Width='*'/><ColumnDefinition Width='Auto'/></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition/><RowDefinition/></Grid.RowDefinitions>
<Image Grid.RowSpan='2' Width='20' VerticalAlignment='Center' Source='file://AnyTinyImage.png'/>
<TextBlock Grid.Column='1' Grid.Row='0' Margin='2, 0, 0, 0' Foreground='#404040'>%name%</TextBlock>
<TextBlock Grid.Column='1' Grid.Row='1' Margin='40, 0, 0, 0' Foreground='#a0a0a0'>%source%</TextBlock>
<Image Grid.Column='2' Grid.RowSpan='2' Width='20' Source='file://AnyTinyImage.png' Visibility='Hidden'/>
</Grid>
</Border>
</Page>

And I suspect that the reason is the same as before.

The trigger set the TextBlock Visibility to Hidden, and once it is hidden, the mouse is not more over a visible child element.

Note also that the property "Image.Visibility" is not changed. I suspect it is not supported, only TextBlocks. Am I right? Can they be supported?




-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6


Posted By: Krog
Date Posted: 12 April 2012 at 6:23pm
Oh sorry, now I realized that the parser does not uses the "TextBlock." and "Image." in the setter lines, it uses only the Visibility property, right? Because the entire Border is becoming invisible...

-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net