{"id":26214850,"url":"https://github.com/charlierobin/xojo-canvas-buttons","last_synced_at":"2026-02-23T13:09:01.102Z","repository":{"id":109754945,"uuid":"246819506","full_name":"charlierobin/xojo-canvas-buttons","owner":"charlierobin","description":"Canvas-based buttons that “track” like standard system buttons","archived":false,"fork":false,"pushed_at":"2025-07-01T09:19:19.000Z","size":170,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-11T12:47:04.785Z","etag":null,"topics":["button","button-control","realbasic","xojo"],"latest_commit_sha":null,"homepage":null,"language":"Xojo","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charlierobin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-03-12T11:41:32.000Z","updated_at":"2025-07-01T09:19:23.000Z","dependencies_parsed_at":"2025-07-01T10:34:33.854Z","dependency_job_id":null,"html_url":"https://github.com/charlierobin/xojo-canvas-buttons","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/charlierobin/xojo-canvas-buttons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlierobin%2Fxojo-canvas-buttons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlierobin%2Fxojo-canvas-buttons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlierobin%2Fxojo-canvas-buttons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlierobin%2Fxojo-canvas-buttons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charlierobin","download_url":"https://codeload.github.com/charlierobin/xojo-canvas-buttons/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlierobin%2Fxojo-canvas-buttons/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29743765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["button","button-control","realbasic","xojo"],"created_at":"2025-03-12T10:18:42.155Z","updated_at":"2026-02-23T13:09:01.080Z","avatar_url":"https://github.com/charlierobin.png","language":"Xojo","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Button class based on built-in Canvas control\n\nVery similar to the example(s) that ship with Xojo, except that those don’t show how to “track” the mouse pointer like standard system buttons.\n\nThis control responds in the (generally) accepted manner, handling a click in the bounding rect and then rolling out with the mouse button still down, clicking and then moving out (MouseExit) and then moving back in, and handling the mouse up correctly: when rolled out no action triggered, when still within bounds does trigger action.\n\nAlso adds a few custom events to assist with control painting. The original native `Paint( g as Graphics etc )` is replaced with:\n\n`PrePaint_Normal( g As Graphics, areas() As REALbasic.Rect )` for setting up `g` in preparation for a “normal” paint pass (also checking if `enabled` is true or false, and drawing the control differently depending on the result)\n\n`PrePaint_RolledOver( g As Graphics, areas() As REALbasic.Rect )` for setting up `g` in preparation for a paint pass when the button has been moused over\n\n`PrePaint_MouseDown( g As Graphics, areas() As REALbasic.Rect )` for setting up `g` in preparation for a pass when the mouse button has been clicked down over the button\n\n`Paint_Common( g As Graphics, areas() As REALbasic.Rect )` as the actual painting routine using whatever colours etc have been set-up in the pre-passes\n\nAll this is in the `CanvasButton` base class. The simple caption button in the test window is subclassed from that, showing how to use it as a simple jumping off point for more complicated buttons.\n\n![Screenshot of states](/screenshots/image.jpg)\n\n# Notes as of 9th June 2025\n\nThere's now an excellent series of blog posts (by Gabriel Ludosanu) on the Xojo website which go into a lot of great detail about creating a custom button control in Xojo using the canvas control:\n\n[How To Create a Custom Button Control in Xojo](https://blog.xojo.com/2025/05/02/how-to-create-a-custom-button-control-in-xojo/)\n\n[How To Create a Custom Button Control in Xojo – Part 2](https://blog.xojo.com/2025/05/14/how-to-create-a-custom-button-control-in-xojo-part-2/)\n\n[How To Create a Custom Button Control in Xojo – Part 3: Make Your Controls Inspector-Friendly](https://blog.xojo.com/2025/05/28/how-to-create-a-custom-button-control-in-xojo-part-3-make-your-controls-inspector-friendly/)\n\n[How To Create a Custom Button Control in Xojo – Part 4: Adding Focus](https://blog.xojo.com/2025/06/23/how-to-create-a-custom-button-control-in-xojo-part-4-adding-focus/)\n\n[How To Create a Custom Button Control in Xojo – Part 5: Adding Text Alignment](https://blog.xojo.com/2025/10/08/how-to-create-a-custom-button-control-in-xojo-part-5-adding-text-alignment/)\n\nHighly recommended!\n\n(And also the [Github repository](https://github.com/xolabsro/CanvasButton) from where you can get the source files for the above blogposts.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlierobin%2Fxojo-canvas-buttons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharlierobin%2Fxojo-canvas-buttons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlierobin%2Fxojo-canvas-buttons/lists"}