terça-feira, 28 de julho de 2015

Windev - Fazer um Editor Texto



VIDEO SOBRE CRIAR EDITOR






















//Novo


EDT_arquivo=""
EDT_Text=""
EDT_Text..Cursor = 1


//Abrir Arquivo
sFile is string
sFile = fSelect("", "", "Seleciona Arquivo...", "Rtf" + TAB + "*.Rtf", "*.Rtf")
EDT_arquivo=sFile
EDT_Text=EDT_arquivo
EDT_Text..Cursor = 1

//Salva Texto

IF EDT_arquivo="" THEN
    sFile is string
    sFile = fSelect("", "", "", "Arquivo Rtf" + TAB + "*.rtf", "*.rtf", fselCreate + fselExist)
    EDT_arquivo=sFile   
END
IF EDT_arquivo = “” THEN RETURN
nFileID     is int = 0
nFileID = fOpen(EDT_arquivo, foCreate + foWrite)  // Abra o arquivo
fWrite(nFileID, EDT_Text, Length(EDT_Text)) // Salva documento
fClose(nFileID)


//Imprimir
iPreview(i100)
iPrintReport(RTFRpt, EDT_Text)


//Importar Imagem
sImagePath    is string = “”
sImagePath = fImageSelect(“”, “”, "Select an image", fGraphicFilter())
IF sImagePath = “” THEN RETURN

IMG_captura = “”
IMG_captura = sImagePath

// The image control is resized to fit the size of the image
IMG_captura..Width = ExtractString(BitmapInfo(sImagePath), 2, TAB)
IMG_captura..Height = ExtractString(BitmapInfo(sImagePath), 3, TAB)

// Copy the image into the clipboard
ToClipboard(IMG_captura)

// Paste the image in the edit control
SendMessage(Handle(EDT_Text), 0x0302, 0, 0)
//ExecuteProcess(TextInput, trtChange)


//Procure
nRequestedType        is int = 0                       
nPositionFound     is int = 0
IF edt_procure = “” THEN RETURN
IF CBOX_CaseCap = 1 THEN nRequestedType = rtfCaseSensitive
nPositionFound = RTFSearch(EDT_Text, edt_procure, nRequestedType)
IF nPositionFound <> 0 THEN
    EDT_Text..Cursor = nPositionFound
    EDT_Text..CursorEnd = nPositionFound + Length(edt_procure)
    ReturnToCapture(EDT_Text)
ELSE
    Info("Procura Completada")
    EDT_Text..Cursor = 1
END


//Substitua
nRequestedType        is int = 0                       
nPositionFound     is int = 0
sSoughtWord         is string = edt_procure
IF edt_procure = “” THEN RETURN
IF CBOX_CaseCap = True THEN nRequestedType = rtfCaseSensitive
nPositionFound = RTFSearch(EDT_Text, edt_procure, nRequestedType)
IF nPositionFound <> 0 THEN
    // Select the word found
    EDT_Text..Cursor = nPositionFound
    EDT_Text..CursorEnd = nPositionFound + Length(edt_procure)
    Multitask(10)
    RTFReplace(EDT_Text, EDT_Substitue, nPositionFound, nPositionFound + Length(edt_procure)) // Substitui Texto   
    ReturnToCapture(EDT_Text)
ELSE
    Info("Substituicao Completada")   
    EDT_Text..Cursor = 1
END



Nenhum comentário:

Postar um comentário

Teste

Teste
teste