hyperlinks_20in_20text_20boxes
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
hyperlinks_20in_20text_20boxes [2018/03/31 13:19] – external edit 127.0.0.1 | hyperlinks_20in_20text_20boxes [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
//by Richard Russell, January 2007//\\ \\ **The code in this article is not applicable to Windows 9x, Windows Me or Windows NT4.**\\ \\ On occasion you may want to incorporate clickable // | //by Richard Russell, January 2007//\\ \\ **The code in this article is not applicable to Windows 9x, Windows Me or Windows NT4.**\\ \\ On occasion you may want to incorporate clickable // | ||
+ | <code bb4w> | ||
linktext$ = "For details of the full version of BBC BASIC for Windows email "+ \ | linktext$ = "For details of the full version of BBC BASIC for Windows email "+ \ | ||
\ "< | \ "< | ||
+ | </ | ||
Here two hyperlinks are included in the text string, but there can be as many as you like. You can also incorporate **line breaks** using the usual CRLF sequence (**" | Here two hyperlinks are included in the text string, but there can be as many as you like. You can also incorporate **line breaks** using the usual CRLF sequence (**" | ||
===== Dialogue box ===== | ===== Dialogue box ===== | ||
\\ Firstly some initialisation: | \\ Firstly some initialisation: | ||
+ | <code bb4w> | ||
INSTALL @lib$+" | INSTALL @lib$+" | ||
Line 15: | Line 18: | ||
SYS " | SYS " | ||
SYS LinkWindow_RegisterClass% | SYS LinkWindow_RegisterClass% | ||
+ | </ | ||
Note that in this application you must use **WINLIB2B** (rather than WINLIB2 or WINLIB2A) so that the **WM_NOTIFY** messages are forwarded and can be intercepted using **ON SYS**.\\ \\ The next step is to create the dialogue box. In this example it contains only the link window, but you can of course incorporate any of the normal dialogue box controls:\\ \\ | Note that in this application you must use **WINLIB2B** (rather than WINLIB2 or WINLIB2A) so that the **WM_NOTIFY** messages are forwarded and can be intercepted using **ON SYS**.\\ \\ The next step is to create the dialogue box. In this example it contains only the link window, but you can of course incorporate any of the normal dialogue box controls:\\ \\ | ||
+ | <code bb4w> | ||
lwid% = 101 | lwid% = 101 | ||
dlg% = FN_newdialog(" | dlg% = FN_newdialog(" | ||
Line 22: | Line 27: | ||
WS_VISIBLE = & | WS_VISIBLE = & | ||
PROC_dlgctrl(dlg%, | PROC_dlgctrl(dlg%, | ||
+ | </ | ||
Note that the link window has been allocated the ID number **101**. Refer to the documentation for [[http:// | Note that the link window has been allocated the ID number **101**. Refer to the documentation for [[http:// | ||
+ | <code bb4w> | ||
PROC_showdialog(dlg%) | PROC_showdialog(dlg%) | ||
SYS " | SYS " | ||
+ | </ | ||
Note the use of the control' | Note the use of the control' | ||
+ | <code bb4w> | ||
*SYS 1 | *SYS 1 | ||
WM_NOTIFY = &4E | WM_NOTIFY = &4E | ||
ON SYS PROCsys(@msg%, | ON SYS PROCsys(@msg%, | ||
+ | </ | ||
The **PROCsys** routine is listed at the end of the article.\\ \\ | The **PROCsys** routine is listed at the end of the article.\\ \\ | ||
===== Main output window ===== | ===== Main output window ===== | ||
\\ Firstly some initialisation: | \\ Firstly some initialisation: | ||
+ | <code bb4w> | ||
INSTALL @lib$+" | INSTALL @lib$+" | ||
Line 40: | Line 51: | ||
SYS " | SYS " | ||
SYS LinkWindow_RegisterClass% | SYS LinkWindow_RegisterClass% | ||
+ | </ | ||
You can alternatively use the **WINLIB5A** library, in which case remember to pass the window handle **@hwnd%** as the first parameter of **FNcreatewindow**.\\ \\ The link window is created, with the required text, as follows:\\ \\ | You can alternatively use the **WINLIB5A** library, in which case remember to pass the window handle **@hwnd%** as the first parameter of **FNcreatewindow**.\\ \\ The link window is created, with the required text, as follows:\\ \\ | ||
+ | <code bb4w> | ||
lwid% = 101 | lwid% = 101 | ||
WS_BORDER = &800000 | WS_BORDER = &800000 | ||
hlink% = FN_createwindow(" | hlink% = FN_createwindow(" | ||
\ lwid%, WS_BORDER, 0) | \ lwid%, WS_BORDER, 0) | ||
+ | </ | ||
Refer to the documentation for [[http:// | Refer to the documentation for [[http:// | ||
+ | <code bb4w> | ||
*SYS 1 | *SYS 1 | ||
WM_NOTIFY = &4E | WM_NOTIFY = &4E | ||
ON SYS PROCsys(@msg%, | ON SYS PROCsys(@msg%, | ||
+ | </ | ||
The **PROCsys** routine is listed below.\\ \\ | The **PROCsys** routine is listed below.\\ \\ | ||
===== PROCsys ===== | ===== PROCsys ===== | ||
\\ The //interrupt service routine// listed below responds the **WM_NOTIFY** messages received from the link window when one of the hyperlinks is clicked:\\ \\ | \\ The //interrupt service routine// listed below responds the **WM_NOTIFY** messages received from the link window when one of the hyperlinks is clicked:\\ \\ | ||
+ | <code bb4w> | ||
DEF PROCsys(M%, W%, L%) | DEF PROCsys(M%, W%, L%) | ||
CASE M% OF | CASE M% OF | ||
Line 63: | Line 80: | ||
ENDCASE | ENDCASE | ||
ENDPROC | ENDPROC | ||
+ | </ | ||
If there is more than one hyperlink in the text you can determine which was clicked from the **nmlink.item.iLink%** value (0 corresponds to the first hyperlink, 1 to the second etc.). For the purposes of demonstration the value is printed to the screen; in a real application you will want to take a different action.\\ \\ Note that the usual [[http:// | If there is more than one hyperlink in the text you can determine which was clicked from the **nmlink.item.iLink%** value (0 corresponds to the first hyperlink, 1 to the second etc.). For the purposes of demonstration the value is printed to the screen; in a real application you will want to take a different action.\\ \\ Note that the usual [[http:// |
hyperlinks_20in_20text_20boxes.1522502364.txt.gz · Last modified: 2024/01/05 00:17 (external edit)