Skip to content

FAQ

Frequently Asked Questions about cToast.

Table of Contents

Basic Questions

Q1: What is cToast?

A: cToast is a message notification component in the VBMan framework, used to display brief message popups. It supports multiple display positions, state themes, and intelligent stacking, providing a simple and elegant notification solution.

Q2: Do I need to create an instance every time?

A: Not necessarily. If you use the global singleton VBMAN.Toast, you can call it directly from anywhere without creating an instance. For more complex management needs, you can create a cToast instance and use it multiple times.

Q3: What display positions are supported?

A: cToast supports 9 display positions:

  • Left: LeftTop, LeftCenter, LeftBottom
  • Center: CenterTop, Center, CenterBottom
  • Right: RightTop, RightCenter, RightBottom

Q4: What state themes are available?

A: cToast supports 4 state themes:

  • Info (blue) - Information messages
  • Success (green) - Success messages
  • Warning (yellow) - Warning messages
  • Danger (red) - Error messages

Q5: What color themes are available?

A: cToast supports 2 color themes:

  • Light (default) - Light theme, suitable for light interfaces
  • Dark - Dark theme, suitable for dark interfaces

Usage Questions

Q6: How to quickly display a simple message?

A: Use the simplest method:

vb
' Method 1: Create instance
With New cToast
    .Show "Operation successful!"
End With

' Method 2: Global singleton
VBMAN.Toast.Show "Operation successful!"

Q7: How to set display duration?

A: Set the second parameter of the Show method (in milliseconds):

vb
' Display for 2 seconds
Toast.Show "Message", 2000

' Display for 5 seconds
Toast.Show "Message", 5000

' No auto-close (persistent)
Toast.Show "Message", 0

Q8: How to set display position?

A: Use the Pos method:

vb
' Top-right corner
Toast.Pos(RightTop).Show "Message", 2000

' Center
Toast.Pos(Center).Show "Message", 2000

' Bottom-left
Toast.Pos(LeftBottom).Show "Message", 2000

Q9: How to display multiple messages with stacking?

A: Messages will automatically stack:

vb
With New cToast
    .Pos(RightTop)
    
    ' These messages will stack automatically
    .State(Info).Show "Message 1", 0
    .State(Success).Show "Message 2", 0
    .State(Warning).Show "Message 3", 0
End With

Q10: How to close a specific popup?

A: Use the Tag method to name it, then close with CloseMe:

vb
' Display named popup
Toast.Tag("msg1").Show "Message 1", 0

' Close specific popup
Toast.CloseMe "msg1"

Q11: How to close all popups?

A: Use the CloseAll method:

vb
Toast.CloseAll

Q12: How to check if a popup exists?

A: Use the Exists method:

vb
If Toast.Exists("msg1") Then
    Debug.Print "Popup exists"
Else
    Debug.Print "Popup does not exist"
End If

Q13: How to get the current number of popups?

A: Use the Count property:

vb
Debug.Print "Current popups: " & Toast.Count

Q14: How to get a list of all active popups?

A: Use the ActiveKeys property:

vb
Dim Keys As Collection
Dim Key As Variant

Set Keys = Toast.ActiveKeys

For Each Key In Keys
    Debug.Print CStr(Key)
Next Key

Q15: How to monitor popup count changes?

A: Use the OnToastCountChange event:

vb
Private WithEvents Toast As cToast

Private Sub Toast_OnToastCountChange(ByVal TagName As String, _
                                     ByVal IsDelete As Boolean, _
                                     ByVal CurrentCount As Long)
    Debug.Print "Count changed: " & CurrentCount
End Sub

Q16: Why doesn't the popup close automatically?

A: Check if the delay parameter is set to 0:

vb
' No auto-close
Toast.Show "Message", 0

' Auto-close after 3 seconds
Toast.Show "Message", 3000

Q17: Why is the popup not showing?

A: Check the following:

  1. Is the Show method called?
  2. Is the Tag name repeated (duplicate popups are not created)?
  3. Is the form loaded properly?
  4. Is there an error in the code?

Technical Questions

Q18: What is the difference between Center and other positions?

A: Center positions (Center, LeftCenter, RightCenter) are overlay mode - only one popup can be displayed, new ones overlay old ones. Other positions support stacking mode and can display multiple popups simultaneously.

Q19: How does stacking work?

A:

  • Top positions (CenterTop, LeftTop, RightTop): Sequential stacking, newest at the bottom
  • Bottom positions (CenterBottom, LeftBottom, RightBottom): Reverse stacking, newest at the top
  • Center positions: No stacking, overlay mode

Q20: How to manually set stacking index?

A: Use the InstIndex method:

vb
Toast.Pos(RightTop).InstIndex(0).Show "Message at index 0", 0
Toast.Pos(RightTop).InstIndex(1).Show "Message at index 1", 0

Q21: Why doesn't the center position support stacking?

A: Center position is designed for important single-message notifications, using overlay mode to ensure message prominence. If stacking is needed, use top or bottom positions.

Q22: How to implement chain calls?

A: All configuration methods return Me, supporting chained calls:

vb
With New cToast
    .Pos(RightTop).State(Success).Theme(Dark).Tag("msg1").Show "Message", 2000
End With

Q23: How to use events?

A: Declare variable WithEvents:

vb
Private WithEvents Toast As cToast

Private Sub Form_Load()
    Set Toast = New cToast
End Sub

Private Sub Toast_OnToastCountChange(ByVal TagName As String, _
                                     ByVal IsDelete As Boolean, _
                                     ByVal CurrentCount As Long)
    ' Handle event
End Sub

Q24: What form types are used internally?

A: cToast uses two form types:

  • FToastCenter: Used for Center, CenterTop, CenterBottom positions
  • FToastDrawer: Used for other 6 positions

Q25: How to modify popup appearance?

A: Appearance is controlled by state and theme:

  • State controls color and icon (Info, Success, Warning, Danger)
  • Theme controls background color (Light, Dark)

For deeper customization, you need to modify the form code.

Performance Questions

Q26: Will multiple popups affect performance?

A: cToast is optimized for performance. Generally, displaying 10-20 popups will not affect performance. However, displaying too many (over 50) may consume more system resources.

Q27: Does the popup consume system resources?

A: Each popup creates a form instance, consuming some memory and window resources. It is recommended to close unneeded popups promptly to free resources.

Q28: How to optimize performance in high-frequency notification scenarios?

A: Suggestions:

  1. Use batch notifications instead of multiple popups
  2. Reasonably set display duration
  3. Close unneeded popups promptly
  4. Limit the maximum number of simultaneous popups

Extension Questions

Q29: Can I add custom icons?

A: The standard version does not support custom icons. You need to modify the form code to add custom icon support.

Q30: Can I add animations?

A: The standard version does not support animations. You can modify the form code to add fade-in, slide-in, and other animation effects.

Q31: Can I play sound on popup display?

A: The standard version does not support sound. You can add your own sound playing code in the Show method.

Q32: Can I click the popup to perform an action?

A: The standard version does not support click actions. You can add a form Click event to implement custom actions.

Q33: Can I add a progress bar?

A: The standard version does not support progress bars. You need to extend the form code to add progress bar support.

Q34: Can I use HTML or RTF formatted text?

A: The standard version only supports plain text. To support rich text, you need to use a rich text control and modify the form code.

Q35: Can I customize the popup size?

A: The standard version's popup size is fixed. If you need to change the size, modify the form's dimensions.

Q36: Can I support multiple monitors?

A: The standard version defaults to the primary monitor. To support multiple monitors, modify the position calculation code.

Q37: Can I create custom themes?

A: The standard version only supports Light and Dark themes. To add custom themes, modify the theme enumeration and related code.

Other Questions

Q38: Is cToast thread-safe?

A: cToast is not designed for multithreading. It is recommended to use it in the main thread.

Q39: How to handle errors?

A: Use standard VB6 error handling:

vb
On Error GoTo ErrorHandler

Toast.Pos(RightTop).Show "Message", 2000

Exit Sub

ErrorHandler:
    Debug.Print "Error: " & Err.Description

Q40: How to log popup display history?

A: Use the OnToastCountChange event to record:

vb
Private Sub Toast_OnToastCountChange(ByVal TagName As String, _
                                     ByVal IsDelete As Boolean, _
                                     ByVal CurrentCount As Long)
    Dim action As String
    action = IIf(IsDelete, "Closed", "Displayed")
    LogToFile action & ": " & TagName & " at " & Now()
End Sub

Q41: How to integrate cToast into existing projects?

A: Steps:

  1. Copy cToast.cls and related form files to the project
  2. Add reference to cShadow component (if needed)
  3. Add code in the project
  4. Test functionality

Q42: Does cToast have dependencies?

A: cToast depends on the cShadow component (for shadow effects). Ensure that the cShadow component is properly referenced in the project.

Q43: Is cToast compatible with all VB6 versions?

A: cToast requires VB6 SP6 or later. It is recommended to use VB6 SP6 with the latest updates.

Q44: Does cToast support Windows 10/11?

A: Yes, cToast is compatible with Windows XP and later, including Windows 10 and Windows 11.

Q45: Where can I get more help?

A:

Q46: How to report a bug?

A:

  1. Record the detailed steps to reproduce
  2. Provide code example
  3. Describe the expected and actual behavior
  4. Report in QQ group or via other channels

Q47: How to request a new feature?

A:

  1. Describe the feature requirements in detail
  2. Provide usage scenarios
  3. Give your own suggestions on implementation
  4. Feedback in QQ group or other channels

Q48: Is there a demo program?

A: Yes, demo programs are available at: vbman-demo/demos/Toast/. The demo demonstrates various features and usage scenarios.

Q49: How to migrate from older versions?

A:

  1. Read the version update notes
  2. Check if there are API changes
  3. Update code according to the documentation
  4. Test after migration

Q50: What is the future development plan for cToast?

A: The development team will continue to improve cToast functionality and performance. Planned features include:

  • More theme options
  • Animation effects
  • Sound notification
  • Click actions
  • Progress bar support
  • More customization options

Please pay attention to the official channels for the latest updates.

VB6 and LOGO copyright of Microsoft Corporation