FUNC and Macro vs. OOP

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

FUNC and Macro vs. OOP

Post by AUGE_OHR »

hi,

i try to use multi Browse with HMG and have a General Problem.

i can open multi Window with different DBF in Browse/Grid and can navigate with Cursor and Mouse
but when press Fx-Key "twice" e.g. F3 it crash :evil:
Func_OOP.jpg
Func_OOP.jpg (483.51 KiB) Viewed 1362 times
under OOP a Method can called by each Instance but when try to call a Function and DEFINE WINDOW ... :(

so what can i do ... run each Window as Thread :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: FUNC and Macro vs. OOP

Post by AUGE_OHR »

hi,

i think i got it :

all DEFINE WINDOW must use a Macro
now i can use Fx-Key in every Browse Windows without crash

but i have to use Thread to ... else i have to manage WorkArea when press Fx-Key :roll:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: FUNC and Macro vs. OOP

Post by AUGE_OHR »

hi,

i´m think now i got full Way to use multiple Windows with Browse / Grid and Fx-Key :)

have try Thread Concept but got much Problem with DBF ( can´t close DBF ... )
Browse / Grid itself is no Problem while it have WORKAREA / ROWSOURCE
but when using Fx-Key with Action it have to be in right WorkArea

Code: Select all

  ON GOTFOCUS DoFindSelf( cDBF ) ;
as i use Name of DBF as Title and i can "see" it ... but what to do now

Code: Select all

STATIC PROCEDURE DoFindSelf( cDBF )
LOCAL nPosi, cWorkArea
...
      SELECT ( cWorkArea )
now i can Strip ".DBF" and use it as ALIAS Name ... but i need more

so again i use a Array to store Data and use #xTranslate to access 2-Dim Array Item
each Window are ADD to 2-Dim Array and i can use ASCAN() for Position to get Data

is act like CLASS VAR while it have multi Dimension and access Element with Name instead of Number

Code: Select all

//  { cBrowse, cWorkArea, cDBF, cPath, .F., 0, {}, "", {} }
//
#xtranslate oBrowse       => Stack_Browse\[nDimBrowse, 1]
#xtranslate cInArea       => Stack_Browse\[nDimBrowse, 2]
#xtranslate cInDBF        => Stack_Browse\[nDimBrowse, 3]
...
   nPosi := ASCAN( Stack_Browse, { | e | e[ ID_InDBF ] = cDBF } )
   IF nPosi > 0
      nDimBrowse := nPosi
      cWorkArea := cInArea
      SELECT ( cWorkArea )
   ENDIF
RETURN 
as soon Window GOTFOCUS it does scan Array and "switch" nDimBrowse, get right WorkArea and SELECT it.
now i can be sure that Fx-Key work in right WorkArea.

have to test if i still work when press same Fx-Key in different Browse / Grid and call same Function ...

---

as i say i have try Thread, without SELECT, but than again my PUBLIC / STATIC Problem with Thread make Problem.
while it seems to work now without Thread so i try this Way and make more Test (just have test F2 F3/F4)
have fun
Jimmy
Post Reply