Ruler Gadget - Beta 1 sourcecode library
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Finished the gadget, details in first post. It's actually usable now. I think there's something wrong in Tailbite as it compiles the lib fine but generates an IMA in ExamineTabStops() at runtime. The code in that proc is simple and clean and runs perfectly compiled with PureBasic.
I appreciate anyone testing the gadget and reporting anything it does that doesn't seem right, any and all reports are welcome.
I appreciate anyone testing the gadget and reporting anything it does that doesn't seem right, any and all reports are welcome.
BERESHEIT
-
- Addict
- Posts: 1126
- Joined: Wed Oct 15, 2003 12:40 am
- Location: Sweden
- Contact:
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
@netmaestro, move the 'Static Newlist' command to the init procedure and it then works fine with Tailbite.
Actually, simply replacing Static by Global in the NewList() seems to work, and without using the _init procedure. 
Code: Select all
ProcedureDLL RulerGadget_Init()
Global NewList tabs()
EndProcedure

I may look like a mule, but I'm not a complete ass.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Thanks a million srod! You saved me a lot of time. I'd traced the error to the static list and was going to replace it with a self-managed block of allocated memory, which would have taken some fiddly coding. I'd like to avoid globals in libs if possible, it's not a problem for the compiled lib but for .pbi files it's important not to use globals and name them something basic like tabs() as it might conflict with something else a coder is doing. One alternative is to use two sources, one to compile with Tailbite and one to use as .pbi, but that gets to be a pain pretty quick. I compromised by keeping the codebases identical and changing the name of the list to RG_gTabs().
New download available: Library installer, details in first post.
@byo: yup.
New download available: Library installer, details in first post.
@byo: yup.
BERESHEIT
You could define a constant and then use some compiler directives within the underlying procedure:
Code: Select all
;#RulerGadget_StaticLib = 1 ;Uncomment if compiling a static lib.
Code: Select all
CompilerIf Defined(RulerGadget_StaticLib, #PB_Constant)
Global NewList Tabs()
CompilerElse
Static NewList Tabs()
CompilerEndIf
I may look like a mule, but I'm not a complete ass.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Performance update, no new features but the drawing routine for the tabstops is retooled with the following problems fixed:
- If you moved a tabstop under a slider and held it there, the slider would flicker intermittently
- If you dropped several tabstops on top of each other under a slider, they would overwrite the rightmost 2 pixels of the slider, leaving an ugly effect that would stay until the slider was moved
- The tabstops could be dragged downwards, this was to allow them to be removed by dragging off the gadget. This has been changed so that they don't move down at all but will be removed if the mouse pointer goes below a certain distance under the gadget. This is exactly the behavior of Microsoft's (inferior) version, and after much experimentation, I like it better.
- All discernible flicker has now been removed with this update, here at least
Both posted code and library installer are updated with the improvements
- If you moved a tabstop under a slider and held it there, the slider would flicker intermittently
- If you dropped several tabstops on top of each other under a slider, they would overwrite the rightmost 2 pixels of the slider, leaving an ugly effect that would stay until the slider was moved
- The tabstops could be dragged downwards, this was to allow them to be removed by dragging off the gadget. This has been changed so that they don't move down at all but will be removed if the mouse pointer goes below a certain distance under the gadget. This is exactly the behavior of Microsoft's (inferior) version, and after much experimentation, I like it better.
- All discernible flicker has now been removed with this update, here at least
Both posted code and library installer are updated with the improvements
BERESHEIT
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
You're most welcome


Me too! I went into it with the idea that it's little more than an ownerdrawn scrollbar with a couple extras added on, now a week and 800 lines of code later I'm still not finished! I'm doing RulerUndo(#actions) today, then a help file and it really should be done. I actually held off a couple of days before starting it because I figured there was a good chance a) something off-the-shelf was around, or b) your fellow Buckeye would take up the cause. But I guess he's snoozing in front of old WKRP reruns or something...Little did I know what it would involve -

BERESHEIT
ROFnetmaestro wrote: snip b) your fellow Buckeye would take up the cause. But I guess he's snoozing in front of old WKRP reruns or something...


I figured between the two of you something would be made. But I actually expected something based off a control and API's. I had no idea it would be quite this involved or I would have felt too guilty to ask

This is 'legacy' code - and I don't mean that in the mainframe sense.
cheers
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada