Page 1 of 1

HMG4 reset

Posted: Wed Jun 15, 2011 4:37 pm
by l3whmg
Hi Mauricio.
I read about Reset function. I'm sorry, but I think it's no a good idea this style and I think there are other problems.
Only one WND_MAIN must exists, but with HMG4 I can start with a Modal (see below).
Please take a look to this

Code: Select all

   IF   ::nType == WND_MAIN   // Main
      // Initialization
      ::s_qApp   := QApplication()
      Resource():New()
      PUBLIC __cActiveWindow := ''
   ENDIF
I think is dangerous. If we speaking about HMG3 ok, but with HMG4 I can start an application with a Modal window. Why? If I need to show (ie) a LoginForm? Before, I must show a Modal form, if it's all right I show MainForm else I shutdown my project. I have tried to use the OnInit procedure on the MainForm, but it doesn't work well.
This was my previous code that I must rewrite and now I use a Modal Window before MainForm. I'm sorry it's a pseudo-code

Code: Select all

FUNCTION Main()
....
ShowMainForm()

RETURN NIL

FUNCTION ShowMainForm()
....
 WITH OBJECT MainForm....
:OnInit := {|| OnInit() }
....
FUNCTION OnInit()

lGranted := ShowLogin()

IF lGranted == .F.
 MainForm:Release() <=== this create problem
....

FUNCTION ShowLogin()

WITH OBJECT LoginForm
......
On the other hand I think there are other reason to have a starter.

Please take a look to this code (window.prg evolution) and check it with zipped files.
Attention: it's an example extracted (it's real but not tested) from my little HMG, that I use to do test

Code: Select all

CLASS WINDOW FROM BASIC

........

METHOD New() CLASS WINDOW

   IF ::s_qStarted == .F.
      HMGQT():Start()
   ENDIF

........

METHOD Create CLASS Window

........

   // IF Window is The Main Window Then Create Application
   IF   ::nType == WND_MAIN   // Main
      PUBLIC __cActiveWindow := ''
   ENDIF

........
But I can use HMGQT():Start() in different way
ie

Code: Select all

FUNCTION Main( hb_aparams )

 PUBLIC oHmgQt := HMGQT():Start( hb_aparams )  <== this is not HMG3 but a HMG4 evolution.

......
It's a very little brief, but take a look to hmgqt.prg source and try to understand my pov (I hope it's clear).
I'm at your disposal.

Best regards

Re: HMG4 reset

Posted: Thu Jun 16, 2011 11:51 am
by concentra
Hi Luigi !
Your code about locales are great !
I have problems with default dialogs showing in English when they should be in the local language.
Please implement locales in the HMG4 code.

Re: HMG4 reset

Posted: Thu Jun 16, 2011 11:58 am
by concentra
I wasn´t talking about a starter at all.
This is a reset, to make possible running QT environment more than one time in the same execution.
My application main interface isn´t QT, it´s WVT pseudo console.
The main WVT interface must call QT interfaces again and again and get back to WVT.
The first time I call QT everything goes Ok, but after that it will only work fine if I reset HMG4 shared data to its initial values.

Re: HMG4 reset

Posted: Thu Jun 16, 2011 12:11 pm
by l3whmg
Hi Mauricio.
Thanks for your words about starter. I'll do other test and after name mod I propose this change. On the other hand Harbour QT don't have QString class (I ask to MrDuck clarification about this) that it's very usefull.

About your problem I read (but very fast and it's not clear for me) on QT docs there is a way to run QApplication only one time: but, I repeat, I don't understand very well.

Best regards

Re: HMG4 reset

Posted: Thu Jun 16, 2011 12:25 pm
by concentra
l3whmg wrote:On the other hand Harbour QT don't have QString class (I ask to MrDuck clarification about this) that it's very usefull.
If you ask for the implementation in harbour-devel@googlegroups.com to Pritpal Bedi I am pretty sure he will do it ASAP.
If you want, I can ask.
About your problem I read (but very fast and it's not clear for me) on QT docs there is a way to run QApplication only one time: but, I repeat, I don't understand very well.
I will try to make a small self contained sample and post here.

Re: HMG4 reset

Posted: Thu Jun 16, 2011 12:40 pm
by l3whmg
Hi Mauricio.
If can you ask do it. At the same time, about Qlocale, I send you (via personal e-mail) a file which contains language and country definition like Qt define them. It's not present on Harbour QT and I have used to setup Italian or English or ...
Best regards