Added 'RaGetTabLabelText/RaSetTabLabelText' functions to set/get the Tab tet

This commit is contained in:
AIR 2023-01-14 13:22:43 -05:00
parent 8ab2a5de22
commit 5a70bb242c
2 changed files with 28 additions and 26 deletions

View File

@ -113,28 +113,7 @@ SUB SetupMenu(parent as HWND)
END SUB
FUNCTION GetTabLabelText$(index AS INTEGER)
DIM AS TCITEM tabItem
DIM tabLabel$
tabItem.mask = TCIF_TEXT
tabItem.pszText = tabLabel
tabItem.cchTextMax = sizeof(tabLabel)
TabCtrl_GetItem(ghMainTab, index, &tabItem)
FUNCTION = TRIM$(tabLabel)
END FUNCTION
SUB SetTabLabelText(fname$, index AS INTEGER)
DIM AS TCITEM tabItem
tabItem.mask=TCIF_TEXT
tabItem.pszText = BCXSPLITPATH$(fname$,FNAME OR FEXT)
tabItem.cchTextMax = BCXSTRSIZE
TabCtrl_SetItem(ghMainTab, index, &tabItem)
END SUB
'================================================================
@ -143,20 +122,20 @@ BEGIN EVENTS
SELECT CASE CBMSG
CASE WM_SHOWWINDOW
SetTabLabelText("New.bas",0)
RaSetTabLabelText("New.bas",0)
CASE WM_COMMAND
SELECT CASE CBCTL
CASE mnuOpen
dim fname$
IF TRIM$(GetTabLabelText(RaGetTab())) <> "New.bas" THEN
IF TRIM$(RaGetTabLabelText(RaGetTab())) <> "New.bas" THEN
RaNewEdit()
END IF
fname$ = RaLoadFile(ghEdit[RaGetTab()])
IF LEN(fname$) THEN
SetTabLabelText(fname$, RaGetTab())
RaSetTabLabelText(fname$, RaGetTab())
END IF
CASE mnuSave

View File

@ -158,7 +158,7 @@ SUB RaSaveFile(hEDT as HWND)
eSIZE = GetWindowTextLength(hEDT)
DIM eTEXT$*eSIZE+1
tabName$ = GetTabLabelText(TabCtrl_GetCurSel(ghMainTab))
tabName$ = RaGetTabLabelText(TabCtrl_GetCurSel(ghMainTab))
IF tabName$ = "New.bas" THEN
fNAME$ = GETFILENAME$("Save","BCX Files|*.BAS;*.INC;*.bi;*.bci",1,ghMainFrm,0,0,tabName$,0)
@ -171,7 +171,7 @@ SUB RaSaveFile(hEDT as HWND)
OPEN fNAME$ FOR BINARY NEW AS FP1
PUT$ FP1, eTEXT$, LEN(eTEXT$)
CLOSE FP1
SetTabLabelText(fNAME$, RaGetTab())
RaSetTabLabelText(fNAME$, RaGetTab())
END IF
END SUB
@ -179,6 +179,29 @@ FUNCTION RaGetTab() AS INTEGER
FUNCTION = TabCtrl_GetCurSel(ghMainTab)
END FUNCTION
FUNCTION RaGetTabLabelText$(index AS INTEGER)
DIM AS TCITEM tabItem
DIM tabLabel$
tabItem.mask = TCIF_TEXT
tabItem.pszText = tabLabel
tabItem.cchTextMax = sizeof(tabLabel)
TabCtrl_GetItem(ghMainTab, index, &tabItem)
FUNCTION = TRIM$(tabLabel)
END FUNCTION
SUB RaSetTabLabelText(fname$, index AS INTEGER)
DIM AS TCITEM tabItem
tabItem.mask=TCIF_TEXT
tabItem.pszText = BCXSPLITPATH$(fname$,FNAME OR FEXT)
tabItem.cchTextMax = BCXSTRSIZE
TabCtrl_SetItem(ghMainTab, index, &tabItem)
END SUB
SUB RaGotoLine(hEDT as HWND, Line AS INTEGER)
Dim chrg As CHARRANGE
DIM GotoLine