Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Need a nice versatile container
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Need a nice versatile container

 Post Reply Post Reply
Author
Message
DaveB View Drop Down
Groupie
Groupie


Joined: 13 March 2009
Status: Offline
Points: 52
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaveB Quote  Post ReplyReply Direct Link To This Post Topic: Need a nice versatile container
    Posted: 16 May 2009 at 1:26am
I need a container control that allows me to do this:
 
 
It needs rounded corners and a built-in drop-shadow property.  The text can either be labels placed inside the container - or the container would have a Caption property that use the markup language and allow multiple lines (\par).
 
Is this possible with any of the CJ controls right now?  If not, is this being worked on?  If you could add this type of container control, I would gladly pay an upgrade fee...
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2009 at 5:27pm
You could do this with markup...the lines between items might be a bit tricky to calculate, but it could be done. Here's a basic example that fulfils the following:

1) Multiple lines via word wrap or line-breaks
2) Rounded corners
3) Drop shadow

Screenshot:



Here's the markup that you can add to a Label (with EnableMarkup = True set) or MarkupLabel control:


<Border Background='#c0c0d0'>
  <Grid Margin='10px'>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width='Auto'/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
    <RowDefinition Height='Auto'/>
    </Grid.RowDefinitions>
    <Border Margin='3,3,0,0' BorderThickness='5' CornerRadius='10' BorderBrush='#50000000'></Border>
    <Border Margin='0,0,4,4'BorderThickness='1' CornerRadius='10' BorderBrush='Black' Background='White'></Border>
    <StackPanel Orientation='Vertical' MaxWidth='140px'>
       <TextBlock Margin='10,10,12,0' TextWrapping='Wrap'><Bold>Edwin Payson Marvin</Bold></TextBlock>
       <TextBlock Margin='10,0,12,10' TextWrapping='Wrap'><Italic>14 Jan 1968&#8211;</Italic></TextBlock>
       <TextBlock Margin='10,0,12,10' TextWrapping='Wrap'>Test of multiple lines with word-wrapping<LineBreak/>and line-breaks.</TextBlock>
    </StackPanel>
  </Grid>
</Border>


If you are using the MarkupLabel control, you can use the markup objects to create a set of reusable classes...check out my chart example for how this could work.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2009 at 5:28pm
Forgot to mention, that the one thing it doesn't fulfil is the container requirement...do you need the control to act as a container for other controls, or was that requirement based on the need for dropping labels into it?
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
DaveB View Drop Down
Groupie
Groupie


Joined: 13 March 2009
Status: Offline
Points: 52
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaveB Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2009 at 4:18am
Wow, that's great.  I am going to have to learn to use markup...
 
I still think a container control with all these properties would be really nice.  For now I will play around with your sample.
 
Thanks for taking the time to put it together.
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2009 at 11:47am
You can create your own control with all of the properties/features that you need. I've put together an example using the MarkupLabel objects instead of (hard to work with) XAML strings:

uploads/20090517_114527_AdvancedLabel.zip

It's incomplete, but should give you a good starting point. Try it out, and if you have any questions, please get back to me.

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
DaveB View Drop Down
Groupie
Groupie


Joined: 13 March 2009
Status: Offline
Points: 52
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaveB Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2009 at 9:30pm
The AdvancedLabel has almost everything I need... almost.
 
Is there a way to change the main background color of the label from white to something else?  I need to be able to change the fill color of each label depending on the family line they are in.
 
Also, I need to put a graphic in the upper-right corner to indicate a link to another database.
 
 
This graphic needs to be click-able so that I can head off and do something when they click it.
 
Any help on this would be greatly appreciated.
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0
Back to Top
DaveB View Drop Down
Groupie
Groupie


Joined: 13 March 2009
Status: Offline
Points: 52
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaveB Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2009 at 5:59am
This would be really easy if CJ would just add rounded corners and shadow to the Resizer control.  Then I could drop in anything I wanted.  (And while you are at it, add rounded corners, shadow, and a border to the ShortcutCaption control.)
 
This would make excellent controls Xtremely excellent... 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2009 at 9:23am
Hi Dave,

You can change the background colour of the label area as follows:


Set mo_Page.Background = UserControl.MarkupLabel1.MarkupContext.CreateSolidBrush(GetActualColor(X))


Where X is the colour (or system colour) that you want to use.

Unfortunately, the Image object is broken in the current release of the MarkupLabel, so we'll have to wait for the next version to add that feature.

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
DaveB View Drop Down
Groupie
Groupie


Joined: 13 March 2009
Status: Offline
Points: 52
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaveB Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2009 at 2:48pm

In VB6:

If I have an AdvancedLabel1 on a form, what would the actual code be to change the background of it to &HFFC0C0 ?
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0
Back to Top
DaveB View Drop Down
Groupie
Groupie


Joined: 13 March 2009
Status: Offline
Points: 52
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaveB Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2009 at 3:04pm
The more I work with this AdvancedLabel control, the more it seems to be missing.
 
Looking at the events, there is a GotFocus and LostFocus (which seems very strange for a label-type control), but there is no Click or DblClick or MouseDown or MouseMove or MouseUp.
 
I need to be able to use Click, DblClick, and MouseMove at a minimum.  Is there any way to do this?
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2009 at 3:17pm
The project I sent you was a basic demo to illustrate how your initial requirements could be implemented using the MarkupLabel control. I'm a bit busy with my own work right now to write the project for you, but you can add the events you require to the supplied usercontrol and fire them using the RaiseEvents method whenever appropriate.  As for the colour, the VB6 code is as I supplied (you can wrap this code in a property in the UserControl and the call the property from your parent form just like any other property. See the BackColor property in the UserControl code for an example).

Unfortunately, it doesn't look like the MarkupLabel supports Click, DblClick or MouseMove so you would have to implement a handler on the constituent markup objects...See this post for more information on implementing events for markup objects.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2009 at 5:13pm
I had a chance to try out a few more things with the MarkupLabel control.

MouseMove & Click events were fairly straight forward, although getting the cursor position required API calls. DblClick proves to be more elusive. The MarkupLabel doesn't expose a DblClick handler, so you would have to calculate the time between clicks and register a double-click if they were close enough together. This is enough of a pain in the butt that I don't feel like doing it. Here's the latest sample though (also adds PageColor property):

uploads/20090519_170904_AdvancedLabel.zip

Some questions for Codejock:

1) Is the MarkupLabel a windowless control, or is the Hwnd property just not exposed? If we could have access to the Hwnd property for subclassing, that would very useful.
2) Any chance of adding a MouseDblClick event handler for all of the markup objects?
3) Any chance of having access to the Mouse coordinates in the appropriate scalemode units without having to resort to API calls?
4) Any chance of control level Mouse events for the MarkupLabel control (MouseMove, MouseUp, MouseDown, Click, DblClick, etc...) rather than having to resort to markup object level handlers?

Thanks in advance for any answers to the above questions.

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
DaveB View Drop Down
Groupie
Groupie


Joined: 13 March 2009
Status: Offline
Points: 52
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaveB Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2009 at 8:07pm
Wow, you are amazing.  I feel like I should be paying you for this...
 
I use a Resize control (not to be confused with the CJ Resizer control) that automatically resizes everything in the window as it is stretched larger and smaller.  Normally this also adjusts the size of the fonts on the screen but since there is no Font property exposed for the Caption, Subcaption, and Body text, it doesn't change them.  Am I correct in assuming that I could use the markup language to change the font attributes on Form_Resize?  Or do you have some other magical way to accomplish this?
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2009 at 8:37pm
Send funds to Account #12345 at my bank

Actually, I'm glad to help a bit with this (as I find time), because I am also interested in the capabilities and limitations of the new markup objects.

You do have complete control over the fonts for the MarkupTextBlock objects. In the supplied UserControl, those objects are stored in the mo_Caption, mo_SubCaption and mo_Body object variables, so you can change their Font* properties at any time. Because everything is wrapped in a UserControl, you can create your own public font property/properties to mirror the MarkupTextBlock font properties (FontFamily, FontSize, FontStyle, etc...they aren't identically named to the standard VB font properties), or you can just change the font size in the UserControl_Resize event.

My best advice would be to look over the supplied Usercontrol code closely and play around with it to see what results you can get. If you get stumped, get back to me and I will try to help.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.266 seconds.