$OPTIMIZE ON
$APPTYPE GUI
$TYPECHECK ON
$INCLUDE "C:\RAPIDQ\DEBUG2.INC"
CONST CRLF=CHR$(13) & CHR$(10)
CONST GWL_STYLE AS LONG = (-16)
CONST VK_CAPITAL = &H14
CONST VK_NUMLOCK = &H90
CONST VK_INSERT = &H2D
DEFSTR CURSPRV
DEFBYTE MODPREV,CAPSPREV,NUMPREV,INSRTSTAT
DECLARE SUB DOTIMER
DECLARE SUB DOINIT
DECLARE SUB DORESIZE
DECLARE SUB INSERTSTAT(key AS BYTE,shift AS BYTE)
DECLARE FUNCTION SetWindowLong LIB "User32" ALIAS _
"SetWindowLongA" (hwnd AS LONG, nIndex AS LONG, _
dwNewLong AS LONG) AS LONG
DECLARE FUNCTION GetWindowLong LIB "user32" ALIAS _
"GetWindowLongA"(hwnd AS LONG, nIndex AS LONG) AS LONG
DECLARE FUNCTION SetParent LIB "user32" ALIAS _
"SetParent" (hWndChild AS LONG, hWndNewParent _
AS LONG) AS LONG
DECLARE FUNCTION GetKeyState LIB "user32" ALIAS _
"GetKeyState" (nVirtKey AS LONG) AS INTEGER
CREATE TIMEX AS QTIMER
INTERVAL=50
ONTIMER=DOTIMER
END CREATE
CREATE RFONT AS QFONT
NAME="LETTER GOTHIC"
SIZE=10
END CREATE
CREATE BFONT AS QFONT
NAME="ARIAL"
SIZE=10
BOLD=1
END CREATE
CREATE SBFONT AS QFONT
NAME="ARIAL"
SIZE=8
BOLD=1
END CREATE
CREATE FORM AS QFORM
CAPTION="STATUSBAR BITMAPS DEMO"
ONSHOW =DOINIT
Width = 490
Height = 520
Center
CREATE MenuBar1 AS QMAINMENU
CREATE FileMenu AS QMENUITEM
CAPTION = "&File"
END CREATE
CREATE EditMenu AS QMENUITEM
CAPTION = "&Edit"
END CREATE
CREATE ToolsMenu AS QMENUITEM
CAPTION = "&Tools"
END CREATE
CREATE HelpMenu AS QMENUITEM
CAPTION = "&Help"
END CREATE
END CREATE
CREATE REdit AS QRICHEDIT
Left = 0
Top = 89
Width = 532
Height = 382
Align = 5
FONT=RFONT
ONKEYDOWN=insertstat
HideSelection = 0
PlainText = 1
ScrollBars = 3
WantTabs = 1
TabOrder = 0
END CREATE
CREATE StatusBar AS QSTATUSBAR
ADDPANELS "","",""
Panel(0).Width = 185
Panel(1).Width = 180
Panel(2).CAPTION="C:\RapidQ\Examples\zipview.rqb"
END CREATE
CREATE STPANEL AS QPANEL
HEIGHT=StatusBar.HEIGHT-5
BEVELOUTER=0
TOP=4
CREATE IMAGE1 AS QIMAGE
TRANSPARENT=1
LEFT=0
BMP="C:\RapidQ\BMP\INSERTONsq.BMP"
END CREATE
CREATE IMAGE2 AS QIMAGE
TRANSPARENT=1
LEFT=44
BMP="C:\RapidQ\BMP\CAPSONsq.BMP"
END CREATE
CREATE IMAGE3 AS QIMAGE
TRANSPARENT=1
LEFT=88
BMP="C:\RapidQ\BMP\NUMONsq.BMP"
END CREATE
CREATE IMAGE4 AS QIMAGE
TRANSPARENT=1
LEFT=132
BMP="C:\RapidQ\BMP\SAVEDsq.BMP"
END CREATE
END CREATE
END CREATE
SUB DOINIT
DEFLNG STYLE
FORM.FONT=SBFONT
style = GetWindowLong(Stpanel.handle, GWL_STYLE)
SetWindowLong Stpanel.handle, GWL_STYLE,style
SetParent Stpanel.Handle , Statusbar.Handle
STPANEL.WIDTH=StatusBar.PANEL(1).WIDTH - 4
END SUB
SUB INSERTSTAT(KEY,SHIFT)
DEFBYTE KEYST
IF KEY=45 AND SHIFT=0 THEN
INSRTSTAT=1-INSRTSTAT
IF INSRTSTAT=0 THEN
IMAGE1.BMP="C:\RAPIDQ\BMP\INSERTONSQ.BMP"
ELSE
IMAGE1.BMP="C:\RAPIDQ\BMP\INSERTOFFSQ.BMP"
END IF
END IF
END SUB
SUB DOTIMER
DEFSTR CAPSTR,CURSTR
CURSTR=STR$(REDIT.WHEREY+1) & " : " & _
STR$(REDIT.WHEREX+1) _
& " / " & STR$(REDIT.LINECOUNT) & _
" Lines, Size=" & STR$(LEN(REDIT.text))
IF CURSPRV<>CURSTR THEN
CURSPRV=CURSTR
StatusBar.PANEL(0).CAPTION=CURSTR
StatusBar.PANEL(0).WIDTH=FORM.TEXTWIDTH(CURSTR)+6
STPANEL.LEFT=StatusBar.PANEL(0).WIDTH + 3
END IF
IF MODPREV<>REDIT.MODIFIED THEN
MODPREV=REDIT.MODIFIED
IF REDIT.MODIFIED THEN
IMAGE4.BMP="C:\RapidQ\BMP\MODIFYsq.BMP"
ELSE
IMAGE4.BMP="C:\RapidQ\BMP\SAVEDsq.BMP"
END IF
END IF
IF CAPSPREV<>GetKeyState(VK_CAPITAL) OR _
NUMPREV<>GetKeyState(VK_NUMLOCK) THEN
CAPSPREV=GetKeyState(VK_CAPITAL)
NUMPREV=GetKeyState(VK_NUMLOCK)
IF CAPSPREV THEN
IMAGE2.BMP="C:\RapidQ\BMP\CAPSONsq.BMP"
ELSE
IMAGE2.BMP="C:\RapidQ\BMP\CAPSOFFsq.BMP"
END IF
IF NUMPREV THEN
IMAGE3.BMP="C:\RapidQ\BMP\NUMONsq.BMP"
ELSE
IMAGE3.BMP="C:\RapidQ\BMP\NUMOFFsq.BMP"
END IF
END IF
END SUB
SetWindowLong FORM.HANDLE, -8, 0
SetWindowLong application.HANDLE, -8, FORM.HANDLE
FORM.SHOWMODAL
|