New dialog class

Moderator: Rathinagiri

Post Reply
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

New dialog class

Post 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
[[]] Mauricio Ventura Faria
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: New dialog class

Post 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 ?
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: New dialog class

Post 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.
[[]] Mauricio Ventura Faria
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: New dialog class

Post 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.
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: New dialog class

Post 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.
[[]] Mauricio Ventura Faria
Post Reply