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 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 SELECT CASE CBMSG
CASE WM_SHOWWINDOW CASE WM_SHOWWINDOW
SetTabLabelText("New.bas",0) RaSetTabLabelText("New.bas",0)
CASE WM_COMMAND CASE WM_COMMAND
SELECT CASE CBCTL SELECT CASE CBCTL
CASE mnuOpen CASE mnuOpen
dim fname$ dim fname$
IF TRIM$(GetTabLabelText(RaGetTab())) <> "New.bas" THEN IF TRIM$(RaGetTabLabelText(RaGetTab())) <> "New.bas" THEN
RaNewEdit() RaNewEdit()
END IF END IF
fname$ = RaLoadFile(ghEdit[RaGetTab()]) fname$ = RaLoadFile(ghEdit[RaGetTab()])
IF LEN(fname$) THEN IF LEN(fname$) THEN
SetTabLabelText(fname$, RaGetTab()) RaSetTabLabelText(fname$, RaGetTab())
END IF END IF
CASE mnuSave CASE mnuSave

View File

@ -158,7 +158,7 @@ SUB RaSaveFile(hEDT as HWND)
eSIZE = GetWindowTextLength(hEDT) eSIZE = GetWindowTextLength(hEDT)
DIM eTEXT$*eSIZE+1 DIM eTEXT$*eSIZE+1
tabName$ = GetTabLabelText(TabCtrl_GetCurSel(ghMainTab)) tabName$ = RaGetTabLabelText(TabCtrl_GetCurSel(ghMainTab))
IF tabName$ = "New.bas" THEN IF tabName$ = "New.bas" THEN
fNAME$ = GETFILENAME$("Save","BCX Files|*.BAS;*.INC;*.bi;*.bci",1,ghMainFrm,0,0,tabName$,0) 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 OPEN fNAME$ FOR BINARY NEW AS FP1
PUT$ FP1, eTEXT$, LEN(eTEXT$) PUT$ FP1, eTEXT$, LEN(eTEXT$)
CLOSE FP1 CLOSE FP1
SetTabLabelText(fNAME$, RaGetTab()) RaSetTabLabelText(fNAME$, RaGetTab())
END IF END IF
END SUB END SUB
@ -179,6 +179,29 @@ FUNCTION RaGetTab() AS INTEGER
FUNCTION = TabCtrl_GetCurSel(ghMainTab) FUNCTION = TabCtrl_GetCurSel(ghMainTab)
END FUNCTION 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) SUB RaGotoLine(hEDT as HWND, Line AS INTEGER)
Dim chrg As CHARRANGE Dim chrg As CHARRANGE
DIM GotoLine DIM GotoLine