FAQ
Frequently Asked Questions about cToast.
Table of Contents
- Basic Questions
- Usage Questions
- Technical Questions
- Performance Questions
- Extension Questions
- Other Questions
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:
' 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):
' Display for 2 seconds
Toast.Show "Message", 2000
' Display for 5 seconds
Toast.Show "Message", 5000
' No auto-close (persistent)
Toast.Show "Message", 0Q8: How to set display position?
A: Use the Pos method:
' Top-right corner
Toast.Pos(RightTop).Show "Message", 2000
' Center
Toast.Pos(Center).Show "Message", 2000
' Bottom-left
Toast.Pos(LeftBottom).Show "Message", 2000Q9: How to display multiple messages with stacking?
A: Messages will automatically stack:
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 WithQ10: How to close a specific popup?
A: Use the Tag method to name it, then close with CloseMe:
' 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:
Toast.CloseAllQ12: How to check if a popup exists?
A: Use the Exists method:
If Toast.Exists("msg1") Then
Debug.Print "Popup exists"
Else
Debug.Print "Popup does not exist"
End IfQ13: How to get the current number of popups?
A: Use the Count property:
Debug.Print "Current popups: " & Toast.CountQ14: How to get a list of all active popups?
A: Use the ActiveKeys property:
Dim Keys As Collection
Dim Key As Variant
Set Keys = Toast.ActiveKeys
For Each Key In Keys
Debug.Print CStr(Key)
Next KeyQ15: How to monitor popup count changes?
A: Use the OnToastCountChange event:
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 SubQ16: Why doesn't the popup close automatically?
A: Check if the delay parameter is set to 0:
' No auto-close
Toast.Show "Message", 0
' Auto-close after 3 seconds
Toast.Show "Message", 3000Q17: Why is the popup not showing?
A: Check the following:
- Is the Show method called?
- Is the Tag name repeated (duplicate popups are not created)?
- Is the form loaded properly?
- 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:
Toast.Pos(RightTop).InstIndex(0).Show "Message at index 0", 0
Toast.Pos(RightTop).InstIndex(1).Show "Message at index 1", 0Q21: 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:
With New cToast
.Pos(RightTop).State(Success).Theme(Dark).Tag("msg1").Show "Message", 2000
End WithQ23: How to use events?
A: Declare variable WithEvents:
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 SubQ24: 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:
- Use batch notifications instead of multiple popups
- Reasonably set display duration
- Close unneeded popups promptly
- 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:
On Error GoTo ErrorHandler
Toast.Pos(RightTop).Show "Message", 2000
Exit Sub
ErrorHandler:
Debug.Print "Error: " & Err.DescriptionQ40: How to log popup display history?
A: Use the OnToastCountChange event to record:
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 SubQ41: How to integrate cToast into existing projects?
A: Steps:
- Copy cToast.cls and related form files to the project
- Add reference to cShadow component (if needed)
- Add code in the project
- 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:
- Check documentation: API Reference, Examples, Technical Details
- Join QQ group: 915520648
- Visit official website: https://vb6.pro/
- View source code for more details
Q46: How to report a bug?
A:
- Record the detailed steps to reproduce
- Provide code example
- Describe the expected and actual behavior
- Report in QQ group or via other channels
Q47: How to request a new feature?
A:
- Describe the feature requirements in detail
- Provide usage scenarios
- Give your own suggestions on implementation
- 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:
- Read the version update notes
- Check if there are API changes
- Update code according to the documentation
- 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.