Page 1 of 2

bAction on Help Button at Dialog Title Bar!?

PostPosted: Tue Oct 21, 2008 1:46 pm
by JC
It's possible to execute some action when the help button of caption bar at dialog is clicked?

Dialog-Title

PostPosted: Tue Oct 21, 2008 2:36 pm
by ukoenig
Hello JC,

I think, the absolute control what happens inside the Dialog-Title,
you can get only with creating your own one.

Image

Inside the Dialog, you can define flags for the help :

Code: Select all  Expand view

// Help-Button
// ---------------------
REDEFINE BITMAP oBmp2  ID 101 ADJUST RESOURCE "Help1"  ;
CURSOR oCursor OF oDlg
oBMP2:bLClicked := { || MyHelp( flag ) }

// ------- Any Actions or Infos -----------------

STATIC FUNCTION MYHELP(flag)

If flag = 1
   MsgAlert( "Help-Info 1","Help")
Endif
If flag = 2
   HELP_FUNC1()
Endif

RETURN NIL



Regards
Uwe :lol:

PostPosted: Tue Oct 21, 2008 5:00 pm
by JC
Uwe,

Thank you very much but, I still can't understanding you ;(

Dialog-Title

PostPosted: Tue Oct 21, 2008 5:32 pm
by ukoenig
Hello JC,

What you have to do if you work with resources :

At first, delete the title-text of the dialog ( you need a dialog-frame with no Title )
2. Place a bitmap on top of the dialog ( on the place where the title has been ).
3. At the end ( righthandside ) put some more bitmaps for the buttons.

sample : 1. Bitmap = Title, 2. Bitmap = help, 3. Bitmap = Minimize, 4. Bitmap = Exit.

A Resource-sample :

Code: Select all  Expand view

TESTSOURCE DIALOG 92, 20, 463, 308
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_DLGFRAME
FONT 11, "Arial"
{
CONTROL "", 110, "TXBrowse", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 54, 39, 351, 217
CONTROL "", 100, "TBitmap", 0 | WS_CHILD | WS_VISIBLE, -1, 1, 401, 18
CONTROL "", 103, "TBitmap", 0 | WS_CHILD | WS_VISIBLE, 443, 1, 20, 18
DEFPUSHBUTTON "Exit", 60, 360, 280, 60, 22
DEFPUSHBUTTON "&1. Sample", 10, 38, 280, 60, 22
DEFPUSHBUTTON "&2. Sample", 20, 101, 280, 60, 22
DEFPUSHBUTTON "&3. Sample", 30, 164, 280, 60, 22
DEFPUSHBUTTON "&4. Sample", 40, 227, 280, 60, 22
DEFPUSHBUTTON "&5. Sample", 50, 290, 280, 60, 22
EDITTEXT 120, 150, 260, 200, 12
RTEXT "Change Title on Change", -1, 61, 262, 86, 8
CONTROL "", 102, "TBitmap", 0 | WS_CHILD | WS_VISIBLE, 422, 1, 20, 18
CONTROL "", 101, "TBitmap", 0 | WS_CHILD | WS_VISIBLE, 401, 1, 20, 18
}



The same you can do without resources.

The complete source you can find in another topic :

http://fivetechsoft.com/forums/viewtopic.php?t=13035

Regards
Uwe :lol:

PostPosted: Tue Oct 21, 2008 7:11 pm
by JC
Uwe,

Really, I don't want to create some bitmap's to elaborate a caption bar with buttons on dialog.
I want to use the default buttons of a dialog... the help button with ? symbol!

Is it possible to do?

Dialog-Titles

PostPosted: Tue Oct 21, 2008 7:22 pm
by ukoenig
Hello JC,

As far as i know, it is not possible to use the normal
Dialog-header-buttons ( system ), to use them for your own functions.
The ? - button uses the normal help-system.
That was the reason, i did something by my own.

But why not to create your own dialog-title ?.
It gives you much more control and you can do things like color-changing,
are not possible in a normal dialog-title.

Regards
Uwe :lol:

PostPosted: Wed Oct 22, 2008 11:03 am
by JC
Uwe,

Yes, you are right! I will try your solution and answer about the results!
Thank you!

Dialog-Title

PostPosted: Wed Oct 22, 2008 11:13 am
by ukoenig
Hello JC,

The shown sample is a bit extrem, just to show how it works.
You can choose size and color of the dialog-title in this way,
the user doesn't notice, that there is something extra done.

I will put a sample on this topic, you don't see any difference
between the < normal > dialog-title and your own one.

Regards
Uwe :lol:

PostPosted: Wed Oct 22, 2008 12:11 pm
by JC
Uwe,

Look this! Method of dialog class!

Code: Select all  Expand view
METHOD SysCommand( nWParam, nLParam ) CLASS TDialog

   if nWParam == SC_CLOSE .and. ::lModal
      if GetCapture() != 0
         ReleaseCapture()
      endif   
      return .f.
   endif

   if nWParam == SC_HELP
      ? "Some block code..."  <--- your own source code!
      ::lHelpIcon = .t.
      return .f.
   endif

return Super:SysCommand( nWParam, nLParam )


Here is possible to execute! :D

Sys-command

PostPosted: Wed Oct 22, 2008 1:42 pm
by ukoenig
Hello JC,

Thank you for the information,

i will have a closer look at the TDialog-class.

Greetings from Germany
uwe :lol:

Dialog-system-buttons

PostPosted: Wed Oct 22, 2008 4:21 pm
by ukoenig
Hello JC,

I added a function in the TDIALOG-class
for :

METHOD SysCommand( nWParam, nLParam )

#define SC_HELP 61824
#define SC_CLOSE 61536 // 0xF060

it works fine.

As well it is a solution, to control the EXIT-Button.

Regards
Uwe :lol:

PostPosted: Wed Oct 22, 2008 6:49 pm
by JC
Uwe,

That's right! ;)

Message from System-Dialog-Buttons

PostPosted: Wed Oct 22, 2008 7:15 pm
by ukoenig
Hello JC,

I did some tests and found a problem.
Do you have a solution, how to connect to the Dialog-Id / name ?
I think, inside the class you have just to call a function for the HELP and EXIT.
The function must be defined in your main-prog.
Inside the function you need the name or the Id of the dialog
to start different actions. I think, you don't want the same action
for all dialogs.

As a sample :
If the user clicks on the exit-button, you could save vars
before closing the dialog.

It gets more difficult, if you want to start a action in
relation to a GET ( i don't know, if you want to do this ).

Regards
Uwe :lol:

PostPosted: Wed Oct 22, 2008 7:42 pm
by Antonio Linares
Júlio,

A codeblock to be evaluated would be ok for you for such event ?

PostPosted: Wed Oct 22, 2008 7:55 pm
by JC
Antonio Linares wrote:Júlio,

A codeblock to be evaluated would be ok for you for such event ?


Antonio,

A codeblock is the best way for this... Yes, would be ok for me!
But it should be generic... something that can be configure for each dialog...
It's possible!?