FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrowse and nomodal dialogs
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 08:16 AM

I'm having strange problems with XBrowse and nomodal dialogs. Switching from one dialog to another, often I find 0 (zero) as the current workarea. What is the correct way to manage workarea switching in such scenario? I'm currently using oBrw:bGotFocus but it seems that other XBrowse functions are executed before it, so the workarea is not correctly switched.

Any help?

EMG

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 09:46 AM

Enrico, have you tried with oDlg:bGotFocus = { || dbSelectArea( "dbffile" )} .
Best regards
Otto

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 09:54 AM

Yes, same problem. oDlg:bGotFocus doesn't start at all.

EMG

Posts: 99
Joined: Thu Jul 12, 2007 02:02 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 10:15 AM
And try with ?

Code (fw): Select all Collapse
oBrw:bpainted = { || dbSelectArea( "dbffile" )}
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 10:21 AM

Sorry, it doesn't solve the problem. There are some codeblocks in XBrowse that are evaluated before bPainted and bGotFocus, so before workarea setting.

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 02:14 PM

Is there any code in XBrowse that changes the current workarea? Otherwise, who is that selects the workarea number zero? I don't do it for sure.

EMG

Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 03:03 PM

Dear Enrico,

I'm so sorry to ask you.
Do you add "ALIAS" in XBROWSE command? If not, I guess the XBROWSE will read from current workarea.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 03:13 PM

Yes, I already add

ALIAS ALIAS()

Is it correct? But the problem is that the workarea become number zero when I switch to another dialog with another XBrowse.

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 05:08 PM

I assume you are using different workareas for different browses. We can not use same workarea in different xbrowses.
Switching the xbrowses does not switch workareas (does not change the selected workarea).
XBrowse is also not affected by the currently selected workarea.
XBrowse reads from oBrw:cAlias and writes to oBrw:cAlias.

Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 05:13 PM

Yes, I'm using different workareas. But the browses are dinamically created so I can't use any alias, I need that the current workarea is the one of the browse with the focus.

Can it be done?

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 05:19 PM
Can it be done?

Can be done, as long as you programmatically ensure that you are not creating a new Xbrowse for the same alias for which you already created another Xbrowse.
Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 05:24 PM

Yes, I'm sure of that because the aliases are generated by the program. So, what do you suggest for switching the workarea on focus change? Please note that bGotFocus seems not to be enough.

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 06:22 PM

There is no need to switch workareas.
XBrowse has nothing to do with currently selected workarea.

If you still have any problem, please provide a small sample.

Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 07:08 PM

Scenario: two nomodal dialogs (or windows) each with its own browse. The code behind them are the same and relies on the current workarea (this is not my choice). How can I get this working without a way to automatically switch the workarea when a dialog gains the focus?

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: XBrowse and nomodal dialogs
Posted: Fri Oct 09, 2020 08:23 PM
Dear Enrico
I do not think I fully understand the problem that it raises. Can you better explain to me what you need
Here are two non-modal dialogs with xbrowse
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces