WklNavPane
WklNavPane class
Signature
Dim myWklNavPane As New WklNavPane
Summary
Arranges Access's own navigation pane from a model: one custom category with groups, shortcuts under display names, the group the pane opens with, and a lock.
Parameters
None
Remarks
WklNavPane is an object, not a control. The navigation pane stays Access's own; the object writes one custom category into it and leaves the built-in categories (Object Type, Tables and Related Views) and other custom categories as they are.
- Designer and store.
ShowDesigneropens the navigation pane designer for the current database (also from the add-in menu Database Tools › Add-Ins › WKL Navigation Pane Designer).Savewrites a model into the table USysWklNavPane and applies it at once. - Apply.
Applywrites the saved model into the pane for the environment the database runs in and shows the category, filtered to the start group. Groups and entries carry conditions in the form of the ribbon commands: the connection profile (Profile, shared withWklRibbon), the kind of database (ACCDB, ACCDE, runtime) and a function of the application. What does not hold is not written at all. Because the pane keeps what was written last, an application whose pane differs per environment callsApplywhen it starts; without conditions the pane written once stays. - Take over.
CategoriesandReadCategoryread a custom category someone arranged in Access as a model, so it can be kept as text and built again.
Hiding is a convenience, not a protection: an object left out of the pane can still be opened by code or by name. Where Access shows hidden objects (the option Show Hidden Objects of the navigation options, per Windows user), hidden groups show grayed; a developer machine with that option on sees more than the user.
The model is checked with the same rules everywhere (Check). An entry whose object the database does not have is not a rule violation: Save and Apply leave it out and name it in their result, the build tool stops on it.
Created with New WklNavPane or CreateObject.
| Member | Kind | Summary |
|---|---|---|
| `Check` | Method | Checks a model and returns its problems. |
| `Canonical` | Method | Returns a model in its fixed text form. |
| `Load` | Method | Returns the model of the current database. |
| `Save` | Method | Saves a model in the current database and applies it. |
| `Apply` | Method | Writes the saved model into the navigation pane for the current environment and shows it. |
| `Categories` | Method | Returns the custom categories of the navigation pane. |
| `ReadCategory` | Method | Returns an existing custom category as a model. |
| `ShowDesigner` | Method | Opens the navigation pane designer for the current database. |
| `Profile` | Property | Gets or sets the connection profile the conditions use. |
| `NavigateTo` | Method | Shows the model's category in the navigation pane. |
| `Locked` | Property | Gets or sets whether the navigation pane is locked in this session. |
Code example
' In the Load event of the start form: the pane for this environment (the development
' group shows only in the ACCDB, as the model says).
Private Sub Form_Load()
Dim missing As String
missing = CreateObject("WklForms.NavPane").Apply()
If Len(missing) > 0 Then Debug.Print missing
End Sub
Inheritance
None
Check method
Signature
Function Check(ByVal Model As String) As String
Summary
Checks a model and returns its problems.
Parameters
| Name | Type | Optional | Default | Description |
|---|---|---|---|---|
Model | String | No | – | The model text (JSON). |
Return value: String – One problem per line, in the language of the components; empty when the model can be saved. A text that is no model gives its error as the only line; Check never raises an error.
Remarks
None
Code example
None
Inheritance
Declared by WklNavPane.
Canonical method
Signature
Function Canonical(ByVal Model As String) As String
Summary
Returns a model in its fixed text form.
Parameters
| Name | Type | Optional | Default | Description |
|---|---|---|---|---|
Model | String | No | – | The model text. |
Return value: String – The text the database keeps and the build tool exports: keys in fixed order, defaults left out, two spaces indentation, LF line ends.
Remarks
A text that is no model raises wkeInvalidValue. The canonical text of a canonical text is the same, byte for byte.
Code example
None
Inheritance
Declared by WklNavPane.
Load method
Signature
Function Load() As String
Summary
Returns the model of the current database.
Parameters
None
Return value: String – The model text from USysWklNavPane; empty when the database has none.
Remarks
Needs an Access database open in this process; elsewhere it raises wkeNotConfigured.
Code example
None
Inheritance
Declared by WklNavPane.
Save method
Signature
Function Save(ByVal Model As String, Optional ByVal Apply As Boolean = True) As String
Summary
Saves a model in the current database and applies it.
Parameters
| Name | Type | Optional | Default | Description |
|---|---|---|---|---|
Model | String | No | – | The model text. |
Apply | Boolean | Yes | True | True (default) applies the model at once, as Apply does; False only stores it. |
Return value: String – What Apply returns; empty when not applied.
Remarks
A model with problems raises wkeInvalidValue with the problems; a refused write raises wkeSourceError.
Code example
None
Inheritance
Declared by WklNavPane.
Apply method
Signature
Function Apply() As String
Summary
Writes the saved model into the navigation pane for the current environment and shows it.
Parameters
None
Return value: String – One line per entry whose object the database does not have, in the language of the components; empty when every entry was written.
Remarks
Apply deletes the groups and shortcuts of the model's category and writes them again, creating the category when it is missing; the pane then shows the category, filtered to the start group, and is locked when the model says so. Groups and entries whose condition does not hold are not written. Without a saved model it raises wkeNotConfigured; a model with problems raises wkeInvalidValue; a write Access refuses raises wkeSourceError.
Code example
None
Inheritance
Declared by WklNavPane.
Categories method
Signature
Function Categories() As String
Summary
Returns the custom categories of the navigation pane.
Parameters
None
Return value: String – The names separated by semicolons, in the order of the pane (Access's own category “Custom” included).
Remarks
None
Code example
None
Inheritance
Declared by WklNavPane.
ReadCategory method
Signature
Function ReadCategory(ByVal Category As String) As String
Summary
Returns an existing custom category as a model.
Parameters
| Name | Type | Optional | Default | Description |
|---|---|---|---|---|
Category | String | No | – | The category's name. |
Return value: String – The model text: groups in their order, hidden groups, shortcuts with a display name where it differs from the object name, and whether the group of unassigned objects is hidden.
Remarks
Shortcuts to objects the database no longer has are left out; conditions and the start group start empty. An unknown category raises wkeKeyNotFound.
Code example
None
Inheritance
Declared by WklNavPane.
ShowDesigner method
Signature
Function ShowDesigner() As Boolean
Summary
Opens the navigation pane designer for the current database.
Parameters
None
Return value: Boolean – True when it was closed with OK (the model is saved and applied then).
Remarks
Without a saved model the designer starts with a category named after the database.
Code example
None
Inheritance
Declared by WklNavPane.
Profile property
Signature
Property Get Profile() As String Property Let Profile(RHS As String)
Summary
Gets or sets the connection profile the conditions use.
Parameters
None
Property value: String – A profile name such as DEV, TEST or PROD; an empty text returns to the detected profile.
Remarks
Without a value set, the profile is the one most linked tables use (as WklLinkManager.DetectEnvironment). The value is shared with WklRibbon and lasts for the Access session.
Read/write.
Code example
None
Inheritance
Declared by WklNavPane.
NavigateTo method
Signature
Sub NavigateTo(Optional ByVal Group As String = "")
Summary
Shows the model's category in the navigation pane.
Parameters
| Name | Type | Optional | Default | Description |
|---|---|---|---|---|
Group | String | Yes | "" | The group to filter to; empty (default) shows the start group of the model, or the whole category when it has none. |
Remarks
An unknown group raises wkeSourceError with Access's message; no dialog appears.
Code example
None
Inheritance
Declared by WklNavPane.
Locked property
Signature
Property Get Locked() As Boolean Property Let Locked(RHS As Boolean)
Summary
Gets or sets whether the navigation pane is locked in this session.
Parameters
None
Property value: Boolean – True locks the pane: objects cannot be deleted, renamed or moved to other groups; opening them stays possible.
Remarks
The lock is a state of the Access session (DoCmd.LockNavigationPane) and ends when Access closes. Access offers no way to read it; the value returned is the last one set through WklNavPane in this process, also by Apply with a model that locks.
Read/write.
Code example
None
Inheritance
Declared by WklNavPane.