Page 1 of 1

New dialog class

Posted: Thu Jul 28, 2011 5:55 pm
by concentra
Hi.

I added a dialog class that is a window/form type class simpler than window class objects.
It can be useful to simple data entry or login dialogs.
See demo code:

Code: Select all

#include "hmg.ch"

FUNCTION Main

   HbQt_ErrorSys()

   IF Login()

      ShowMain()

   ENDIF

RETURN NIL

/*----------------------------------------------------------------------*/

STATIC FUNCTION ShowMain()

   LOCAL oMainForm

   DEFINE WINDOW oMainForm
      Row     10
      Col     10
      Width   600
      Height  600
      Title   "oMainForm title"
      Type    WND_MAIN
      OnInit  oMainForm:Center()
   END WINDOW

   ACTIVATE WINDOW oMainForm

RETURN NIL

/*----------------------------------------------------------------------*/

STATIC FUNCTION Login()

   LOCAL oLoginForm, oButtonBox, oBtn_Ok, oBtn_Cancel

   DEFINE DIALOG oLoginForm
      Row     10
      Col     10
      Width   200
      Height  100
      Title   "Login Form Title"
      OnInit  oLoginForm:Center()

      DEFINE BUTTONBOX oButtonBox
         ADD BUTTON oBtn_Ok     ROLE BUTTON_OK     ACTION oLoginForm:Accept()
         ADD BUTTON oBtn_Cancel ROLE BUTTON_CANCEL ACTION oLoginForm:Reject()
      END BUTTONBOX

   END DIALOG

   ACTIVATE DIALOG oLoginForm

   MsgInfo( "Login Exit "+CStr(oLoginForm:lAccepted))

   HB_SYMBOL_UNUSED( oButtonBox )
   HB_SYMBOL_UNUSED( oBtn_Ok )
   HB_SYMBOL_UNUSED( oBtn_Cancel )

RETURN oLoginForm:lAccepted

Re: New dialog class

Posted: Thu Jul 28, 2011 9:54 pm
by mrduck
concentra wrote: I added a dialog class that is a window/form type class simpler than window class objects.
Hi Mauricio
thanks for this new class.

What do you think about always using a QWidget as the parent instead of using the window ?

Re: New dialog class

Posted: Fri Jul 29, 2011 12:21 pm
by concentra
Hi.
mrduck wrote:What do you think about always using a QWidget as the parent instead of using the window ?
Didn't get it... Where ?
In this sample the dialog has no parent at all.

Re: New dialog class

Posted: Fri Jul 29, 2011 12:57 pm
by mrduck
Did you read these threads ?

viewtopic.php?f=32&t=2034 (see but sample code anc omment to Carlos)

and

viewtopic.php?f=32&t=2035
concentra wrote:Hi.
mrduck wrote:What do you think about always using a QWidget as the parent instead of using the window ?
Didn't get it... Where ?
In this sample the dialog has no parent at all.

Re: New dialog class

Posted: Mon Aug 01, 2011 7:18 pm
by concentra
mrduck wrote:Did you read these threads ?
viewtopic.php?f=32&t=2034 (see but sample code anc omment to Carlos)
and
viewtopic.php?f=32&t=2035
Ok. I have an idea o manage this.
Will do some tests and post the result here.