Print Page | Close Window

two different cjstyles on same form (vb6)

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=17961
Printed Date: 28 April 2024 at 8:25am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: two different cjstyles on same form (vb6)
Posted By: auto160
Subject: two different cjstyles on same form (vb6)
Date Posted: 26 February 2011 at 3:40pm
i have two different cjstyles for two different PushButtons on the same form, when using the following code i get both buttons skinned the same no matter what, i try single SkinFramework control then two but no joy.. i obviously missing something Smile  

    SkinFramework.LoadSkin App.Path & "\Green.cjstyles", ""
    SkinFramework.ApplyWindow btnGreen.hWnd
    
    SkinFramework2.LoadSkin App.Path & "\Blue.cjstyles", ""
    SkinFramework2.ApplyWindow BtnBlue.hWnd

thank you much in advance!
Cheers,
A.



Replies:
Posted By: auto160
Date Posted: 27 February 2011 at 3:02pm
okay, still no joy but got some progress, my goal is to to have a few different skins for some buttons on my form, as a proof of concept  i have made a cjstyles file with two schema's in it (Green & Blue):






 

the code is something like this (although i've tried many different syntax with no success):

  SkinFramework1.LoadSkin App.Path & "\Buttons.cjstyles", "Green.ini"
  SkinFramework1.ApplyWindow btnGreen.hWnd

   Set MyBlueSchema = SkinFramework1.CreateSchema(App.Path & "\Buttons.cjstyles", "Blue.ini")
   SkinFramework1.SetWindowTheme BtnBlue.hWnd, MyBlueSchema

the results are that the two buttons are always skinned as per the LoadSkin command.

i found a sample published by Oleg on how to use the CreateSchema so i know the code should work if the cjstyles was designed properly which, i guess, is not the case Cry

please please help me understand this.

thank you all!

BTW - is there any tutorial or help for the Skin Builder?




Posted By: Xander75
Date Posted: 01 March 2011 at 4:35am
Hi,

What you are trying to do is not possible!

The code .ApplyWindow applies the Skin to the Form and all controls, not just a control. Therefore you can't have two different styles running concurrently! 


-------------
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)


Posted By: auto160
Date Posted: 01 March 2011 at 4:52am
thx for your reply.

it can be done, here's a sample published by Oleg in an earlier post i found in my search for solution:  uploads/6647/20090309_032441_Skins1.zip - uploads/6647/20090309_032441_Skins1.zip  
in that project there are three buttons using two different skins...

said that, i now guess that the problem is in the way i implemented the cjstyles, by not define the NormalSize  i have not kept the integrity of the cjstyles file... anyways, i'm keep on trying.. Embarrassed

Best,
A.


Posted By: auto160
Date Posted: 01 March 2011 at 7:03am
well.... still no joy Cry

i edit the cjstyles with NormalSize:


still, cant manage to set one button as green and the other as blue.. i'm lost in space now.. any thoughts?? here's the skin project:  uploads/6647/20090309_032441_Skins1.zip - uploads/6647/20090309_032441_Skins1.zip


Posted By: auto160
Date Posted: 01 March 2011 at 8:05am
this drives me nuts!!!!Confused

now i know for sure that the problem is with the cjstyles file, let me proof it for you all:

this is the office2007.cjstyles file provided by codejock:  uploads/6647/Office2007.rar - uploads/6647/Office2007.rar

using vb6 create a form with three buttons and using the following code you'll get 3 different skinned buttons:

SkinFramework1.LoadSkin App.Path & "\Office2007.cjstyles", ""
SkinFramework1.ApplyWindow Me.hWnd

Set skinSchemaBlue = SkinFramework1.CreateSchema(App.Path & "\Office2007.cjstyles", "LightBlue.INI")
SkinFramework1.SetWindowTheme Command1.hWnd, skinSchemaBlue

Set skinSchemaAqua = SkinFramework1.CreateSchema(App.Path & "\Office2007.cjstyles", "NormalAqua.INI")
SkinFramework1.SetWindowTheme Command2.hWnd, skinSchemaAqua

Set skinSchemaSilver = SkinFramework1.CreateSchema(App.Path & "\Office2007.cjstyles", "NormalSilver.INI")
SkinFramework1.SetWindowTheme Command3.hWnd, skinSchemaSilver

so i'm quite sure that the problem is with the cjstyles file i build using the Skin Builder which has no help nor tutorial?! what gives??? anyways.. any help appreciated..

Best,
A.



Posted By: Oleg
Date Posted: 02 March 2011 at 3:34am
Hi,

Attach your Buttons.skinproj and all images to check where you are.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: auto160
Date Posted: 02 March 2011 at 3:44am
Hi Oleg,
Thank you for your reply, here's the project:  uploads/6647/Buttons.rar - uploads/6647/Buttons.rar
looking forward to your help!! 
Best,
A.


Posted By: SuperMario
Date Posted: 03 March 2011 at 9:25am
If you look at our skin MDI sample open it and add this to the frmDialogBar form for a different skin for each button on that form:

Private Sub Form_Load()

    Dim skinSchemaTemp As SkinSchema
   
    Set skinSchemaTemp = fMainForm.SkinFramework.CreateSchema(App.Path + "..\..\..\..\SkinFramework\Styles\Office2007.cjstyles", "NormalBlack.INI")
    fMainForm.SkinFramework.SetWindowTheme cmdColorDialog.hWnd, skinSchemaTemp
   
    Set skinSchemaTemp = fMainForm.SkinFramework.CreateSchema(App.Path + "..\..\..\..\SkinFramework\Styles\WinXP.Luna.cjstyles", "NormalBlue.INI")
    fMainForm.SkinFramework.SetWindowTheme cmdOpenDialog.hWnd, skinSchemaTemp
   
    Set skinSchemaTemp = fMainForm.SkinFramework.CreateSchema(App.Path + "..\..\..\..\SkinFramework\Styles\Office2007.cjstyles", "NormalSilver.INI")
    fMainForm.SkinFramework.SetWindowTheme cmdPrintDialog.hWnd, skinSchemaTemp
   
    Set skinSchemaTemp = fMainForm.SkinFramework.CreateSchema(App.Path + "..\..\..\..\SkinFramework\Styles\WinXP.Luna.cjstyles", "NormalHomestead.INI")
    fMainForm.SkinFramework.SetWindowTheme cmdFontDialog.hWnd, skinSchemaTemp
   
End Sub

And in main form:
Private Sub MDIForm_Load()
    SkinFramework.LoadSkin App.Path + "..\..\..\..\SkinFramework\Styles\Office2007.cjstyles", "NormalBlue.ini"
    SkinFramework.ApplyWindow Me.hWnd
.....
End Sub


Posted By: SuperMario
Date Posted: 03 March 2011 at 9:28am
Also you only use 1 instance of skin framework like in the sample.  For it to work you must apply a skin to the to the app like in the sample, only then will skinning individual objects work.


Posted By: Oleg
Date Posted: 04 March 2011 at 6:46am
Actually you made all right. Only name of ini in your code should be "NormalBlue.ini" and "NormalGreen.ini"


so such code works for me


Private Sub Form_Load()

' Main application skin    
    SkinFramework1.LoadSkin App.Path & "\Codejock.cjstyles", ""
    SkinFramework1.ApplyWindow Me.hWnd

   Set MyBlueSchema = SkinFramework1.CreateSchema(App.Path & "\Buttons.cjstyles", "NormalBlue.ini")
   SkinFramework1.SetWindowTheme Command1.hWnd, MyBlueSchema
   
   Set MyBlueSchema = SkinFramework1.CreateSchema(App.Path & "\Buttons.cjstyles", "NormalGreen.ini")
   SkinFramework1.SetWindowTheme Command2.hWnd, MyBlueSchema
   
End Sub



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: auto160
Date Posted: 06 March 2011 at 4:46am
thx oleg!
Best,
A.


Posted By: 2bit
Date Posted: 03 March 2013 at 8:18am
dear, my name is Marco. Using vb6 command button on the prj sample there is not problem.
Using Codejock pushbutton the SetWindowTheme does not apply the right schema and pushbutton keeps the global skin loaded  with the loadskin method. What may be the problem?


Posted By: SuperMario
Date Posted: 04 March 2013 at 4:49pm
try using XP or default theme for the push button, then apply skin


Posted By: 2bit
Date Posted: 05 March 2013 at 2:02am
it's not ok. the pushbutton receives from SkinFramework.loadSkin the global skin, but when I apply single SetWindowTheme... it ignores command.
this is the code: a sample with 48 windows command button  and a pushbutton.
I have modify Office2007 skin to have an added skin named "redskin.ini" 

Private Sub Form_Load()

SkinFramework1.LoadSkin App.Path & "\Office20071.cjstyles", "LightBlue.INI"
SkinFramework1.ApplyWindow Me.hWnd

Dim i As Integer


For i = 0 To 47
    If i Mod 3 = 0 Then
        Set skinSchema(i) = SkinFramework1.CreateSchema(App.Path & "\Office20071.cjstyles", "LightBlue.INI")
    ElseIf i Mod 3 = 1 Then
        Set skinSchema(i) = SkinFramework1.CreateSchema(App.Path & "\Office20071.cjstyles", "NormalAqua.INI")
    ElseIf i Mod 3 = 2 Then
        Set skinSchema(i) = SkinFramework1.CreateSchema(App.Path & "\Office20071.cjstyles", "Redskin.ini")
    End If
    
    SkinFramework1.SetWindowTheme Command1(i).hWnd, skinSchema(i)
Next

    Set skinSchema(48) = SkinFramework1.CreateSchema(App.Path & "\Office20071.cjstyles", "Redskin.INI")
   
    SkinFramework1.SetWindowTheme PushButton1.hWnd, skinSchema(48)
    PushButton1.Appearance = PushButton1.Appearance

End Sub



Posted By: 2bit
Date Posted: 05 March 2013 at 12:25pm
have you got any idea about this problem?


Posted By: SuperMario
Date Posted: 13 March 2013 at 9:47am
Sorry, it after going through the code it appears this isn't possible with the push buttons.  You would need to use regular command buttons to do this.


Posted By: 2bit
Date Posted: 13 March 2013 at 9:51am
there is a way to pay a customization?



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