Skip to content

Commit 3e69af1

Browse files
fixed it again
1 parent 816ca04 commit 3e69af1

File tree

7 files changed

+34
-432
lines changed

7 files changed

+34
-432
lines changed

README.md

Lines changed: 7 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ local function OnDraw()
4949
print("Current slider value:", sliderValue)
5050

5151
end
52-
TimMenu.End() -- Always call End() to clean up
5352
end
5453

5554
callbacks.Register("Draw", "ExampleDraw", OnDraw)
@@ -60,9 +59,6 @@ callbacks.Register("Draw", "ExampleDraw", OnDraw)
6059
### Window Management
6160

6261
- Begin: `bool = TimMenu.Begin(title, [visible, [id]])`
63-
- BeginSafe: `bool = TimMenu.BeginSafe(title, [visible, [id]])` - Safe version with error handling
64-
- End: `TimMenu.End()` - Always call to clean up window state
65-
- EndSafe: `TimMenu.EndSafe()` - Safe version with error handling
6662

6763
### Layout
6864

@@ -122,7 +118,6 @@ local function OnDraw()
122118
selectedOption = TimMenu.Dropdown("Quality", selectedOption, options)
123119
end
124120
end
125-
TimMenu.End() -- Always call End() to clean up
126121
end
127122
```
128123

@@ -137,7 +132,6 @@ local function OnDraw()
137132
TimMenu.Text(string.format("RGB: %d, %d, %d, %d",
138133
backgroundColor[1], backgroundColor[2], backgroundColor[3], backgroundColor[4]))
139134
end
140-
TimMenu.End() -- Always call End() to clean up
141135
end
142136
```
143137

@@ -158,61 +152,15 @@ local function OnDraw()
158152
end
159153
end
160154
end
161-
TimMenu.End() -- Always call End() to clean up
162155
end
163156
```
164157

165-
## Recommended Safe Usage Pattern
158+
## Tips
166159

167-
For robust menu creation, use the safe versions of Begin/End with proper error handling:
168-
169-
```lua
170-
local TimMenu = require("TimMenu")
171-
172-
local function CreateSafeMenu()
173-
if TimMenu.BeginSafe("My Safe Menu") then
174-
-- Your widgets here
175-
local value = TimMenu.Slider("Test Slider", 50, 0, 100, 1)
176-
if TimMenu.Button("Test Button") then
177-
print("Button clicked!")
178-
end
179-
end
180-
TimMenu.EndSafe() -- Always called, even if there are errors
181-
end
182-
183-
callbacks.Register("Draw", "SafeMenu", CreateSafeMenu)
184-
```
185-
186-
## Error Detection and Debugging
187-
188-
TimMenu now includes comprehensive assertions and error checking to help debug issues:
189-
190-
### Assertion Coverage
191-
192-
- **Parameter validation** - All functions validate input parameters with detailed error messages
193-
- **Window state validation** - Ensures windows are in valid states before operations
194-
- **Layout validation** - Catches layout issues like infinite expansion, invalid spacing
195-
- **Widget usage validation** - Ensures widgets are only called within Begin/End blocks
196-
- **Dimension validation** - Prevents windows from growing beyond reasonable limits (5000px threshold)
197-
- **Position validation** - Detects invalid window positions that could cause issues
198-
199-
### Common Error Messages
200-
201-
When assertions fail, you'll see detailed error messages like:
202-
```
203-
[TimMenu] Begin: Parameter 'title' cannot be empty string
204-
[TimMenu] AddWidget: Window dimensions too large W=6000, H=3000 (possible infinite expansion)
205-
[TimMenu] NextLine: Must be called between TimMenu.Begin() and TimMenu.End()
206-
[TimMenu] Slider: min (50) must be less than max (25)
207-
[TimMenu] Dropdown: options table cannot be empty
208-
```
209-
210-
### Debugging Tips
211-
212-
- **Enable assertions** by running in debug mode - they help catch issues early
213-
- **Check error messages** carefully - they tell you exactly what went wrong and where
214-
- **Use BeginSafe/EndSafe** for production code to handle assertion failures gracefully
215-
- **Monitor window dimensions** - if windows grow beyond 5000px, there's likely an infinite expansion bug
160+
- Use `BeginSector`/`EndSector` to group widgets in bordered panels.
161+
- Sectors can be easily stacked horizontally and vertically
162+
- All widgets return their current value - no need to track "changed" flags
163+
- Values are automatically maintained between frames by the widget system
216164

217165
## Sector Grouping
218166

@@ -228,7 +176,6 @@ if TimMenu.Begin("Example Window") then
228176
local volume = TimMenu.Slider("Volume", 50, 0, 100, 1)
229177
TimMenu.EndSector()
230178
end
231-
TimMenu.End() -- Always call End() to clean up
232179
```
233180

234181
## Changelog
@@ -245,16 +192,9 @@ TimMenu.End() -- Always call End() to clean up
245192

246193
- Keybind widget now recalculates its display label immediately after a key press and dynamically computes its draw position inside the rendering callback, eliminating frame delay when dragging windows.
247194

248-
### Added Comprehensive Assertions and Error Detection
195+
### Fixed TabControl Header Lag
249196

250-
- **Complete assertion coverage** - Added parameter validation, state checks, and error detection throughout the codebase
251-
- **Detailed error messages** - All assertion failures provide specific information about what went wrong and where
252-
- **Window dimension limits** - Added 5000px threshold to catch infinite expansion issues early
253-
- **Layout validation** - Added checks for invalid spacing, cursor positions, and widget placement
254-
- **Widget usage validation** - Ensures all widgets are called within proper Begin/End blocks
255-
- **Parameter type checking** - Validates all function parameters with descriptive error messages
256-
- **Safe wrapper functions** - BeginSafe() and EndSafe() provide error handling for production use
257-
- **Debugging documentation** - Added comprehensive debugging guide with common error patterns
197+
- Header-mode tabs now calculate their offsets relative to the window's current position at draw time, preventing one-frame lag during window movement.
258198

259199
## License
260200

0 commit comments

Comments
 (0)