$INCLUDE "QREdit.inc"
$RESOURCE Copy_bmp AS "Bitmaps\Copy.bmp"
DECLARE SUB cmdSaveCode_click (sender AS QBUTTON)
DECLARE SUB cmdCopyCode_click (sender AS QBUTTON)
DECLARE SUB cmdClosePreview_click (sender AS QBUTTON)
DECLARE SUB frmResize
CREATE FrmPreview AS QFORM
ICOHandle = MenuDesigner_ico
CAPTION = "MenuDesigner Preview $NoName.inc"
Width = 575
Height = 460
Autoscroll = 0
OnResize = frmResize
windowState = wsMaximized
Center
CREATE cmdSaveCode AS QBUTTON
BMPHandle = Save_bmp
CAPTION = "&Save Code"
Left = 460
Top = 15
Width = 100
onclick = cmdSaveCode_click
END CREATE
CREATE cmdCopyCode AS QBUTTON
BMPHandle = Copy_bmp
CAPTION = "&Copy Code"
Left = 460
Top = 50
Width = 100
onclick = cmdCopyCode_Click
END CREATE
CREATE cmdClosePreview AS QBUTTON
BMPHandle = Exit_bmp
CAPTION = "C&lose Preview"
Left = 460
Top = 85
Width = 100
onclick = cmdClosePreview_Click
END CREATE
CREATE rhtCode AS QREdit
Left = 15
Top = 15
Width = 425
Height = 390
WordWrap = False
Clear
ScrollBars = 3
AddSyntaxes("DECLARE", "SUB", "CREATE ", "END ", " as ", "QMAINMENU", "QMENUITEM")
HiLight
ReadOnly = 0
END CREATE
END CREATE
SUB cmdSaveCode_Click (Sender AS QBUTTON)
DIM ext$ AS STRING
DIM p AS INTEGER
SaveDialog.CAPTION = "Save Menu Include as..."
SaveDialog.Filter = "Menu Include (*.inc)|*.inc|All Files (*.*)|*.*"
IF ArchivoMenu <> "$NoName.inc" THEN
SaveDialog.FileName = ArchivoMenu
ELSE
SaveDialog.FileName = "$NoName.inc"
END IF
IF SaveDialog.EXECUTE THEN
ArchivoMenu = SaveDialog.FileName
ext$ = RIGHT$(ArchivoMenu,4)
IF ext$ <> ".inc" THEN ArchivoMenu = ArchivoMenu + ".inc"
rhtCode.PlainText = 1
rhtCode.SaveToFile ArchivoMenu
p = rinstr(ArchivoMenu,"\\")
ArchivoMenu = MID$(ArchivoMenu,p + 1)
frmPreview.CAPTION = "MenuDesigner Preview " + ArchivoMenu
SHOWMESSAGE ArchivoMenu + " Saved"
END IF
rhtCode.PlainText = 0
END SUB
SUB cmdCopyCode_Click (Sender AS QBUTTON)
ClipBoard.Clear
rhtCode.SelectAll
rhtCode.CopyToClipBoard
rhtCode.SelStart = 1
END SUB
SUB cmdClosePreview_Click (Sender AS QBUTTON)
frmPreview.CLOSE
END SUB
SUB frmResize
rhtCode.width = frmPreview.clientwidth - 150
rhtCode.height = frmPreview.clientheight - rhtCode.top - 10
cmdSaveCode.Left = frmPreview.clientwidth - 115
cmdCopyCode.Left = frmPreview.clientwidth - 115
cmdClosePreview.Left = frmPreview.clientwidth - 115
END SUB
|