Tk_GetDash(3tk)
β¨ NAME β¨
Tk_GetDash β bestie, this is the glow-up where a string becomes a real, valid dash structure π
So like, this is a page from the Tk Library Procedures manual, and it's giving conversion core. Let's go π«Ά
πΈ SYNOPSIS πΈ
#include <tk.h>
int
Tk_GetDash(interp, string, dashPtr)
π ARGUMENTS π
Tcl_Interp *interp(in) β the interpreter we use when we need to report an error, iykyk.const char *string(in) β the textual value that's getting converted, periodt.Tk_Dash *dashPtr(out) β points to the place where we store the dash pattern value that got converted fromstring. Must not beNULL. Not negotiable, bestie, don't even try it π
π DESCRIPTION π
Okay so this procedure parses the string and fills in the result inside the Tk_Dash structure. The string can be a list of integers, OR a character string containing only β.,-_β and spaces. If all goes well, TCL_OK is returned and a dash descriptor is stored in the variable that dashPtr points to. But if string doesn't have the proper syntax, then TCL_ERROR is returned, an error message is left in the interpreter's result, and nothing gets stored at *dashPtr. No partial slay, we either ate or we didn't π₯
β Syntax number one: the integer list
The first possible syntax is a list of integers. Each element represents the number of pixels of a line segment. Only the odd segments are drawn using the βoutlineβ color. The other segments are drawn transparent. The way that it alternates?? iconic honestly.
β Syntax number two: the character list
The second possible syntax is a character list containing only 5 possible characters: β.,-_ β. The space can be used to enlarge the space between other line elements, and can not occur in the first position of the string. Some examples, bestie, so you can see the vision:
-dash . = -dash {2 4}
-dash - = -dash {6 4}
-dash -. = -dash {6 4 2 4}
-dash -.. = -dash {6 4 2 4 2 4}
-dash {. } = -dash {2 8}
-dash , = -dash {4 4}
The main difference between this syntax and the numeric one is that it is shape-conserving. Which means: all values in the dash list will be multiplied by the line width before display. This ensures that β.β will always be displayed as a dot and β-β always as a dash, regardless of the line width. It's literally so consistent of it π
On systems where only a limited set of dash patterns exist, the dash pattern will be displayed as the most close dash pattern that is available. For example, on Windows only the first 4 of the above examples are available; the last 2 examples will be displayed identically to the first one. So like, it's not broken, it's just Windows being Windows π
π¦ SEE ALSO π¦
π KEYWORDS π
dashconversion
Okay that's the whole page bestie, you understood it, you're basically a Tk dash expert now π This one came from Tk 8.3, and yeah, that's the version and the date vibe this page is serving β so like, retro but make it fashion. Mwah π Tk_GetDash(3tk) forever β¨
π¦ where this page comes from
- debian bookworm: tk8.6-doc 8.6.13-2
- debian trixie: tk8.6-doc 8.6.16-1
- debian trixie: tk9.0-doc 9.0.1-3
- ubuntu jammy: tk8.6-doc 8.6.12-1build1
- ubuntu noble: tk8.6-doc 8.6.14-1build1
- ubuntu questing: tk8.6-doc 8.6.17-1
- ubuntu questing: tk9.0-doc 9.0.2-1
- ubuntu resolute: tk8.6-doc 8.6.17-1build1
- ubuntu resolute: tk9.0-doc 9.0.3-1
- ubuntu stonking: tk8.6-doc 8.6.18-1
- ubuntu stonking: tk9.0-doc 9.0.4-1
- Copyright (c) 1989-1993 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms