Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - SaveSatateToXMLString...
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SaveSatateToXMLString...

 Post Reply Post Reply
Author
Message
suja View Drop Down
Newbie
Newbie


Joined: 22 May 2008
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote suja Quote  Post ReplyReply Direct Link To This Post Topic: SaveSatateToXMLString...
    Posted: 26 May 2008 at 12:14am
Hi~~
 
Help me
 
i want to set the State by using
SaveStateToXMLString/LoadStateFromXMLString..
 
when i clicked "Add or Remove Button" and  Saved the State ,
the Button State was not set ....
 
but When i used the RegistryKey, the Button State was Set..
 
is there diffrence from Using Xml and RegistryKey ??
 
 
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2008 at 1:10am
Hello,
 
Check that you give same string to LoadStateFromXMLString that you get from Save. Maybe you save it wrong.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
joeliner View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 June 2006
Status: Offline
Points: 273
Post Options Post Options   Thanks (0) Thanks(0)   Quote joeliner Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2008 at 2:00am
Just a quick one oleg,

as earlier mentioned, we will have the ribbonbar designer in 12.1 (correct me if am wrong). will there be a feature of importing xml generated from ribbonbar to the designer?


Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2008 at 9:51am
Yes.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
joeliner View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 June 2006
Status: Offline
Points: 273
Post Options Post Options   Thanks (0) Thanks(0)   Quote joeliner Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2008 at 9:59am
Splendid!
Back to Top
suja View Drop Down
Newbie
Newbie


Joined: 22 May 2008
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote suja Quote  Post ReplyReply Direct Link To This Post Posted: 27 May 2008 at 1:10am
would you check this method?
as i mentioned the Button State was not set ....
 
 
i want to save the state from each users. and Load that state...
 
 
 
 
'Load the State of CommandBar

Public Sub CommandBar_LoadState(ByVal argIDNumber As String, ByVal argEXEName As String)
   
On Error Resume Next
    Dim FreeF As Integer, sFile As String, sLayout As String
   
    strsql = "          SELECT String From DockingpaneState "
    strsql = strsql & "  WHERE UserID  = '" & Trim$(argIDNumber) & "' "
    strsql = strsql & "    AND EXEName = '" & UCase(argEXEName) & "' "
   
    If Not OpenADO1(strsql) Then Exit Sub
   
    sFile = "c:\" & Trim$(argIDNumber) & ".txt"
    FreeF = FreeFile
    Kill sFile
    Open sFile For Binary As #FreeF
    Put #FreeF, , Trim$(AdoRs1("String"))
    Close #FreeF
   
    AdoRs1.Close
   
    sLayout = Space(FileLen(sFile))
    Open sFile For Binary As #FreeF
    Get #FreeF, , sLayout
    Close #FreeF
    On Error GoTo 0
    CommandBars.LoadStateFromXMLString CommandBars.name, sLayout  ' sLayout, "a"
    Kill sFile
 
End Sub
 
 
 
'Save the State of CommandBar
Public Sub DockingPane_SaveState(ByVal argIDNumber As String, ByVal argEXEName As String)
Dim nCnt As Integer
   
    strsql = "SELECT count(*) as cnt From DockingpaneState "
    strsql = strsql & "  WHERE UserID  = '" & Trim$(argIDNumber) & "' "
    strsql = strsql & "    AND EXEName = '" & UCase(argEXEName) & "' "
   
    Call OpenADO1(strsql)
   
    nCnt = AdoRs1("Cnt")
    AdoRs1.Close
   
    If nCnt = 0 Then
        strsql = "Insert into DockingpaneState values ( "
        strsql = strsql & " '" & Trim$(UserID.IDNumber) & "', "
        strsql = strsql & " '" & UCase(argEXEName) & "', "
        'strsql = strsql & " '" & Trim$(NurseMDI.DockingPaneManager.SaveStateToString) & "') "
        strsql = strsql & " '" & Trim$(NurseMDI.CommandBars.SaveStateToXMLString(NurseMDI.CommandBars.name)) & "' "
    Else
        strsql = "          UPDATE DockingpaneState "
        'strsql = strsql & "    Set string  = '" & Trim$(NurseMDI.DockingPaneManager.SaveStateToString) & "' "
        'strsql = strsql & "    Set string  = '" & Trim$(NurseMDI.CommandBars.SaveStateToString(True, True)) & "' "
    strsql = strsql & "    Set string  = '" & Trim$(NurseMDI.CommandBars.SaveStateToXMLString(NurseMDI.CommandBars.name)) & "' "
        strsql = strsql & "  WHERE UserID = '" & Trim$(argIDNumber) & "' "
        strsql = strsql & "    AND EXEName = '" & UCase(argEXEName) & "' "
    End If
   
    AdoCn.BeginTrans
    If ExecADO(strsql) Then
        AdoCn.CommitTrans
    Else
        AdoCn.RollbackTrans
    End If
   
End Sub
 
 
 
 
 
[this is get from saved file]
 
<CommandBars CompactMode="1">
  <Layout>
    <DockState Version="21" ScreenSize="1280, 1024" Count="2">
      <BarInfo0 BarId="1" MRUWidth="32767"/>
      <BarInfo1 BarId="1694431857" Floating="1" MRUWidth="32767" PointPos="529, 238"
              MRUDockPos="545, 18, 1113, 44" MRUFloatPos="529, 238"/>
    </DockState>
    <DockBars>
      <DockBar0 Count="3" Id1="1"/>
    </DockBars>
  </Layout>
</CommandBars>
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 27 May 2008 at 7:44am

Hi,

Right. by default SaveStateToXMLString don't save controls state.
 
Create Options and set SerializeControls  property:
 
    Dim op As StateOptions
    Set op = CommandBars.CreateStateOptions
    op.SaveOriginalControls = True
    op.SerializeControls = True
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.235 seconds.