MsgInfo with LINK ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

MsgInfo with LINK ?

Post by AUGE_OHR »

hi,

i want to show a Message when "Component" are not installed
i also want to show a LINK to download "Component"

how can i display it :?:

i know i can use a LINK in RICHTEXT ...
have fun
Jimmy
User avatar
gfilatov
Posts: 1090
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: MsgInfo with LINK ?

Post by gfilatov »

AUGE_OHR wrote: Sat Jun 24, 2023 10:50 pm hi,

i want to show a Message when "Component" are not installed
i also want to show a LINK to download "Component"

how can i display it :?:

i know i can use a LINK in RICHTEXT ...
Hi Jimmy,

You will need a wrapper for the Vista TaskDialog() function.

There is the above posibility in MiniGUI with the following ShowMessage() function :arrow:

Code: Select all

FUNCTION ShowMessage( cTitle, cMainMessage, cContent, cExpandedInfo, cFooter, nIcon, nFooterIcon )

   LOCAL aConfig := Array( TDC_CONFIG )
   LOCAL nButton, nRadioButton
   LOCAL lVerificationFlagChecked := .F.

   hb_default( @cTitle, "Vista TaskDialog" )
   hb_default( @cMainMessage, "" )
   hb_default( @cContent, "" )
   hb_default( @cExpandedInfo, "" )
   hb_default( @cFooter, "" )
   hb_default( @nIcon, TD_INFORMATION_ICON )
   hb_default( @nFooterIcon, 0 )

   aConfig[ TDC_TASKDIALOG_FLAGS ]        := TDF_ENABLE_HYPERLINKS
   aConfig[ TDC_COMMON_BUTTON_FLAGS ]     := TDCBF_OK_BUTTON

   aConfig[ TDC_HWND ]                    := GetActiveWindow()
   aConfig[ TDC_HINSTANCE ]               := GetInstance()
   aConfig[ TDC_MAINICON ]                := nIcon

   aConfig[ TDC_WINDOWTITLE ]             := cTitle
   aConfig[ TDC_MAININSTRUCTION ]         := cMainMessage
   IF !Empty( cContent )
      aConfig[ TDC_CONTENT ]              := cContent
   ENDIF
   IF !Empty( cExpandedInfo )
      aConfig[ TDC_EXPANDEDINFORMATION ]  := cExpandedInfo
      aConfig[ TDC_EXPANDEDCONTROLTEXT ]  := "Hide details"
      aConfig[ TDC_COLLAPSEDCONTROLTEXT ] := "Show details"
   ENDIF
   IF !Empty( cFooter )
      IF !Empty( nFooterIcon )
         aConfig[ TDC_FOOTERICON ]        := nFooterIcon
      ENDIF
      aConfig[ TDC_FOOTER ]               := cFooter
   ENDIF

   aConfig[ TDC_CALLBACK ]                := {|h,n,w,l| callback( h,n,w,l )} 

   RETURN win_TaskDialogIndirect0( aConfig, @nButton, @nRadioButton, @lVerificationFlagChecked )


STATIC FUNCTION callback( hWnd, nNotification, wParam, lParam )
   LOCAL lResult := .F.
   /*
   To prevent the task dialog from closing, the application must return FALSE,
   otherwise the task dialog is closed 
   */
   LOCAL hResp := { 1=>"OK", 2=>"CANCEL", 3=>"ABORT", 4=>"RETRY", 5=>"IGNORE", 6=>"YES", 7=>"NO", 8=>"CLOSE" }

   SWITCH nNotification
   CASE TDN_BUTTON_CLICKED
      // wParam - an int that specifies the ID of the button or comand link that was selected
      IF hb_HPos( hResp, wParam ) != 0
         lResult := .T.
      ENDIF
      EXIT

   CASE TDN_HYPERLINK_CLICKED
      ShellExecute( hWnd, "open", lParam, , , SW_SHOW )
   END SWITCH

   RETURN lResult
For example, the following call
ShowMessage( , 'This uses the "ShowMessage" function', ;
"Just use an additional parameter (optional) to add this extra text.", ;
"And another parameter for yet more text. And another parameter for the footer.", ;
'This is the footer with hyperlink <a href="www.hmgextended.com">MiniGUI Software Page</a>', , TD_INFORMATION_ICON )
will show a window like the one below:
capture.png
capture.png (9.92 KiB) Viewed 2936 times
Hope it is helpful. :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
JALMAG
Posts: 265
Joined: Sun Jan 10, 2010 7:05 pm
DBs Used: DBF, MariaDB
Location: España - Spain

Re: MsgInfo with LINK ?

Post by JALMAG »

Very nice!
Thanks
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: MsgInfo with LINK ?

Post by AUGE_OHR »

hi Grigory,
gfilatov wrote: Sun Jun 25, 2023 8:19 am You will need a wrapper for the Vista TaskDialog() function.
thx for Answer and Sample

as i say i want to display a URL for download
but the URL should be "clickable" like in RICHTEXT
have fun
Jimmy
Post Reply