Page 1 of 1
Pastable MsgBox popup
Posted: Mon Dec 13, 2021 5:29 pm
by HGAutomator
Hi,
Is there an existing popup info dialog like MsgBox, that allows you to select part of the message, in order to copy and paste it elsewhere?
Re: Pastable MsgBox popup
Posted: Mon Dec 13, 2021 6:07 pm
by Claudio Ricardo
Hi HG.
I think you'll have to do it with a small window with a read-only EditBox or RichEdit control...
I will do something like this to highlight in bold or color part of the text.
Re: Pastable MsgBox popup
Posted: Mon Dec 13, 2021 8:07 pm
by HGAutomator
Yep, that's what I thought. Ok, thanks C.R.
Claudio Ricardo wrote: ↑Mon Dec 13, 2021 6:07 pm
Hi HG.
I think you'll have to do it with a small window with a read-only EditBox or RichEdit control...
I will do something like this to highlight in bold or color part of the text.
Re: Pastable MsgBox popup
Posted: Wed Dec 15, 2021 7:49 pm
by Claudio Ricardo
Hello, This allows you to copy and what I needed: to highlight part of the text, in addition to changing font and size.
It could be done much better and more neat (even put color) but I have little time for a lot of work.
Code: Select all
cText := "+CRLF Está seguro/a de querer eliminar {TODOS} los datos ? +CRLF Esta acción {NO} puede deshacerse !"
If MsgSiNo ( cText, "Atención !", 150, 320 )

- Screenshot_20211215_163105.png (10.56 KiB) Viewed 829 times
Code: Select all
If MsgSiNo ( cText, "Atención !", 160, 400, "Times-Roman", 12 )

- Screenshot_20211215_162434.png (12.07 KiB) Viewed 829 times
Code: Select all
#include <hmg.ch>
Function MsgSiNo ( cString, cTitle, nHeight, nWidth, cFontName, nFontSize )
LOCAL cText := ""
PRIVATE lRetu := .F.
Default cTitle := ""
Default nHeight := 160
Default nWidth := 400
Default cFontName := "Arial"
Default nFontSize := 9
cString := StrTran ( cString, "+CRLF", "\par" )
cString := HMG_Unicode_To_Ansi ( cString )
cText := '{\rtf1\ansi\pard '
cText += StrTran ( cString, "{", "{\b " )
cText += '}'
Hb_MemoWrit ("Text.rtf", cText)
cText := Hb_MemoRead ("Text.rtf")
DEFINE WINDOW Win_1 AT 0,0 WIDTH nWidth HEIGHT nHeight TITLE cTitle MODAL BACKCOLOR {255,255,255} NOSYSMENU
DEFINE RICHEDITBOX Edit_1
ROW 0
COL 0
WIDTH nWidth - 16
HEIGHT nHeight - 80
VALUE ""
READONLY .T.
FONTNAME cFontName
FONTSIZE nFontSize
TABSTOP .F.
HSCROLL .F.
VSCROLL .F.
END RICHEDITBOX
DEFINE BUTTON Button_1
ROW nHeight - 75
COL nWidth - 240
WIDTH 100
HEIGHT 28
ACTION ExitMsg (.T.)
CAPTION "Ok"
END BUTTON
DEFINE BUTTON Button_2
ROW nHeight - 75
COL nWidth - 125
WIDTH 100
HEIGHT 28
ACTION ExitMsg (.F.)
CAPTION "Cancel"
END BUTTON
END WINDOW
CENTER WINDOW Win_1
Win_1.Edit_1.RTFLoadFile ("Text.rtf", .F., 4)
ACTIVATE WINDOW Win_1
Return lRetu
//--------------------------------------------------------------------------------------------------//
STATIC Procedure ExitMsg (lParam)
Default lParam := .F.
If lParam
lRetu := .T.
EndIf
Ferase ( "Text.rtf" )
DoMethod ("Win_1" , "Release")
Return Nil
Re: Pastable MsgBox popup
Posted: Wed Dec 15, 2021 11:47 pm
by HGAutomator
Looks more than adequate, thanks Claudio.
Claudio Ricardo wrote: ↑Wed Dec 15, 2021 7:49 pm
Hello, This allows you to copy and what I needed: to highlight part of the text, in addition to changing font and size.
It could be done much better and more neat (even put color) but I have little time for a lot of work.
Code: Select all
cText := "+CRLF Está seguro/a de querer eliminar {TODOS} los datos ? +CRLF Esta acción {NO} puede deshacerse !"
If MsgSiNo ( cText, "Atención !", 150, 320 )
Screenshot_20211215_163105.png
Code: Select all
If MsgSiNo ( cText, "Atención !", 160, 400, "Times-Roman", 12 )
Screenshot_20211215_162434.png
Code: Select all
#include <hmg.ch>
Function MsgSiNo ( cString, cTitle, nHeight, nWidth, cFontName, nFontSize )
LOCAL cText := ""
PRIVATE lRetu := .F.
Default cTitle := ""
Default nHeight := 160
Default nWidth := 400
Default cFontName := "Arial"
Default nFontSize := 9
cString := StrTran ( cString, "+CRLF", "\par" )
cString := HMG_Unicode_To_Ansi ( cString )
cText := '{\rtf1\ansi\pard '
cText += StrTran ( cString, "{", "{\b " )
cText += '}'
Hb_MemoWrit ("Text.rtf", cText)
cText := Hb_MemoRead ("Text.rtf")
DEFINE WINDOW Win_1 AT 0,0 WIDTH nWidth HEIGHT nHeight TITLE cTitle MODAL BACKCOLOR {255,255,255} NOSYSMENU
DEFINE RICHEDITBOX Edit_1
ROW 0
COL 0
WIDTH nWidth - 16
HEIGHT nHeight - 80
VALUE ""
READONLY .T.
FONTNAME cFontName
FONTSIZE nFontSize
TABSTOP .F.
HSCROLL .F.
VSCROLL .F.
END RICHEDITBOX
DEFINE BUTTON Button_1
ROW nHeight - 75
COL nWidth - 240
WIDTH 100
HEIGHT 28
ACTION ExitMsg (.T.)
CAPTION "Ok"
END BUTTON
DEFINE BUTTON Button_2
ROW nHeight - 75
COL nWidth - 125
WIDTH 100
HEIGHT 28
ACTION ExitMsg (.F.)
CAPTION "Cancel"
END BUTTON
END WINDOW
CENTER WINDOW Win_1
Win_1.Edit_1.RTFLoadFile ("Text.rtf", .F., 4)
ACTIVATE WINDOW Win_1
Return lRetu
//--------------------------------------------------------------------------------------------------//
STATIC Procedure ExitMsg (lParam)
Default lParam := .F.
If lParam
lRetu := .T.
EndIf
Ferase ( "Text.rtf" )
DoMethod ("Win_1" , "Release")
Return Nil