| |
|
|
 Jörg Sellmeyer |
'Dieser Code liest den Headertext eines Tabcontrols aus.
'von Jörg Sellmeyer zur freien Verfügung für alle
$H commctrl.ph
Struct TC_ITEMHEADER = Mask&,lpReseved1&,lpReseved2&,pszText&,cchTextMax&,iImage&
Declare TC_Item#
Dim TC_Item#, TC_ITEMHEADER
Proc GetTabText
Parameters hTab&,hwnd&,i&
Declare Text#,Text$
Dim Text#,12
With TC_Item#
.cchTextMax& = 24
.Mask& = $0001
.pszText& = Text#
EndWith
SendMessage(hTab&,$01305,i&,TC_Item#)
Text$ = String$(Text#,0)
Dispose Text#
Return Text$
EndProc
Proc SetTabText
Parameters hdl&,Id%,txt$
With TC_Item#
.Cchtextmax& = Len(txt$)
.Mask& = $0001
.Psztext& = Addr(txt$)
Endwith
SendMessage(Tab&,~TCM_SETITEM,Id%,TC_Item#)
EndProc
Proc SetTabIcon
Parameters hTab&,Index%,IconIndex%
Declare TC_Item#
Dim TC_Item#,TC_ITEMHEADER
With TC_Item#
.Mask& = ~TCIF_IMAGE
.iImage& = IconIndex%
EndWith
SendMessage(hTab&,~TCM_SETITEM,Index%,TC_Item#)
EndProc
Declare Tab&
Cls
var hToolBmp& = create("hPic", 0, "TOOLBAR")
var hIL& = Create("ImageList", 16, 16, hToolBmp&, rgb(192, 192, 192))
Tab&=Create("Tabctrl",%hWnd,"Test 5",130,30,460,300)
SendMessage(Tab&, ~TCM_SETIMAGELIST, 0, hIL&)
WhileLoop 4,1,-1
InsertTab(Tab&,0,"Test " + Str$(&Loop))
Wend
WhileLoop 0,4
print "Text = " + GetTabText(Tab&,%hwnd,&Loop)
Wend
Randomize
While 1
WaitInput
Case %umessage = 16:Break
If %mousePressed = 0
SetTabText(Tab&,GetActiveTab(Tab&),Str$(&GetTickCount))
SetTabIcon(Tab&,GetActiveTab(Tab&),Rnd(GetCount(hIL&)))
EndIf
Wend
Dispose TC_Item#
|
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 01.10.2006 ▲ |
|
|
|
|
 Jac de Lad | Wozu soll das gut sein? Ich meine den Header kann ein Benutzer ja nicht verändern...  |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 01.10.2006 ▲ |
|
|
|
|
 Jörg Sellmeyer | Jacob Liebeck
Wozu soll das gut sein? Ich meine den Header kann ein Benutzer ja nicht verändern... 
So kann man dynamische Tabs erstellen und je nach Titel unterschiedlicheAktionen ausführen. Außerdem kannstDu jetzt dem Benutzer gestatten, die Texte zu ändern (per Input$() z. B.) |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 01.10.2006 ▲ |
|
|
|
|
 Jac de Lad | Naja, is schon klar, wird doch aber seeeehr selten auftreten, oder irre ich?  |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 02.10.2006 ▲ |
|
|
|
|
 Jörg Sellmeyer | Umso besser, wenn man dann weiß wie es geht ;) |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 02.10.2006 ▲ |
|
|
|
|
 Jac de Lad | Ja, klar...  |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 03.10.2006 ▲ |
|
|
|
|
 ByteAttack | OK! Dann schieß mal los: Wie ändere ich den bitte einen Text eines schon bestehenden TabControl-Reiters??? |
|
|
| |
|
|
|
 Frank Abbing | Mit der Message TCM_SETITEM. |
|
|
| |
|
|
|
 Jörg Sellmeyer | Wenns immer so einfach wäre, aber MS machts oft unglaublich kompliziert, b.z.w. sind wir von Profan so verwöhnt. Ich habs mal oben in den Code eingefügt. Gruß Jörg |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 24.10.2007 ▲ |
|
|
|
|
 ByteAttack | Dankeschön. Habe mir die halbe Nacht den Kopf zermattert über die MSN-Library und der commctrl.ph. Aber jetzt hast Du es ja reingestellt, und so ne Kleinigkeit mach auch mich glücklich! Dankeschön. |
|
|
| |
|
|
|
 Jörg Sellmeyer | Code oben repariert und um Funktion zum Ändern des Icons ergänzt. |
|
|
| |
|
|