Page 1 of 3

TREE control used as main menu - problems

Posted: Fri Aug 29, 2014 8:48 am
by asacaric
Since I'm new in HMG, I want to take the right direction to create my projects while migrating from Clipper.
My idea is to use TREE control as menu for executing other programs and to make it fluid, fast and with as few clicks as possible.
- I want to split programs - every TREEITEM should have its own PRG
- every PRG creates PANEL type window
- every TREEITEM (PRG) should create its own form and another objects and destroy them after another TREEITEM is double-clicked form MAIN program.
Destroying is necessary because APP could have many PRG's

1) I don't know how to destroy FORM_ARTIKLI or FORM_CATEGORY (called from main program) after another double-click on TREE since ISWINDOWDEFINED(FORM_CATEGORY) returns .T.
- FORM_1.FORM_ARTIKLI.RELEASE and FORM_ARTIKLI.RELEASE return an error in compile: Error E0030 Syntax error "syntax error at '.'"
- THISWINDOW.RELEASE closes main window

2) How to SETFOCUS to GRID_ARTIKLI after TREEITEM is clicked and FORM_ARTIKLI is created?

3) File ARTIKLI.DBF is opened with 4 indexes and I use ON HEADCLICK to SET ORDER.
How to stay on current RecNo() after SET ORDER? If I use GRID_ARTIKLI.REFRESH, it moves on 1st record.
If I don't refresh, GRID_ARTIKLI isn't refreshed and doesn't show correct data.

4) If you double-click on ARTIKLI, then CATEGORY, and back to ARTIKLI - you will still have CATEGORY on your screen
I do understand why, but can you fix it?

5) If you double-click on CATEGORY, then ARTIKLI - you will get an error: Variable does not exist: NAZIV1.
This is what I don't understand since DBF's are opened in different areas and correctly selected.

My appologize for so many questions, but I've tried many combinations, looked in almost every sample, google'd, but nothing helped.
Please^2 help!

Re: TREE control used as main menu - problems

Posted: Fri Aug 29, 2014 11:28 am
by dragancesu
There are many people who will help you, but you will most help yourself if you go to make simple programs

Create a MAIN window, and other MODAL, you'll be easier, and then refines

You set the example and it .hbp file, I was expecting to be compiled, but there are errors, one error because you use the latest version

You have problems with the data, (1) it would be ideal to open the program what it needs and ultimately close or (2) open all at the beginning of the application so close to the end, I use the first method

Then you mentioned the problems easier to solve

***

Ovde ima mnogo ljudi koji će ti pomoći, ali ćeš najviše sebi pomoći ako kreneš da praviš jednostavne programe

Napravi jedan MAIN window, i ostale MODAL, biće ti lakše, a posle doteruj

Postavio si primer i u njemu .hbp fajl, očekivao sam da se može kompilirati ali ima grešaka, jedna je greška jer koristiš najnoviju verziju

Imaš problema sa podacima, (1) idealno bi bilo da program otvori šta mu treba i na kraju zatvori ili (2) otvori sve na početku aplikacije pa zatvori na kraju, ja koristim ovaj prvi način

Onda ćeš navedene probleme lakše rešiti

Pozdrav

Re: TREE control used as main menu - problems

Posted: Fri Aug 29, 2014 12:25 pm
by Agil Abdullah
asacaric wrote:
Since I'm new in HMG, I want to take the right direction to create my projects while migrating from Clipper.
I am in the same situation as you are. I am learning from you. :)

-Agil

Re: TREE control used as main menu - problems

Posted: Fri Aug 29, 2014 1:45 pm
by esgici
asacaric wrote:My appologize for so many questions, but I've tried many combinations, looked in almost every sample, google'd, but nothing helped.
Please^2 help!
Hi asacaric

First : please don't be pessimist, you are between friends here :-)

- You need use "aliased expression" notation when open more than one table.
- When using same window for more than one control, before show one control, you need close or hide other one.

Here slightly modified version of two of your .prg files.

I hope it will help and give some ideas to you.

Happy HMG'ing :D

PS : Does "asacaric" is real human name ? ( I don't like address to my friend with "artifical" name :( )

Re: TREE control used as main menu - problems

Posted: Fri Aug 29, 2014 2:40 pm
by asacaric
@DraganceSu, thanks for your demo app 'home budget', it surely shows me possible way for develop my apps.
@Agil, good luck :)
@Esgici, thank you for your help. You've helped me before over gmail. My name is Alen Sacaric. I can't tell you how happy I am now that my app actually works :) OBRADE.ZIP will be updated with your solution shortly.


Still, I have some remaining issues/questions:

1) Hidden form still uses memory. I really really want to destroy him :)

2) How to SETFOCUS to GRID_ARTIKLI after TREEITEM is clicked and FORM_ARTIKLI is created?

3) File ARTIKLI.DBF is opened with 4 indexes and I use ON HEADCLICK to SET ORDER.
How to stay on current RecNo() after SET ORDER? If I use GRID_ARTIKLI.REFRESH, it moves on 1st record.
If I don't refresh, GRID_ARTIKLI isn't refreshed and doesn't show correct data.

Re: TREE control used as main menu - problems

Posted: Fri Aug 29, 2014 3:58 pm
by esgici
asacaric wrote:You've helped me before over gmail. My name is Alen Sacaric.
Yes, remembered; I'm glad to see you again; how are you ?
1) Hidden form still uses memory. I really really want to destroy him :)
First, don''t worry about memory problems; memory nightmares remain at DOS; in Windows we have (almost) infinite memory :arrow:
Second: think hiding and showing controls / forms is same as "work areas" concept of xBase. You may have multiple open table
and at a time you activate only one of theme by SELECT.
2) How to SETFOCUS to GRID_ARTIKLI after TREEITEM is clicked and FORM_ARTIKLI is created?
As most of HMG controls, GRID too have SETFOCUS method; didn't tried it ?
3) File ARTIKLI.DBF is opened with 4 indexes and I use ON HEADCLICK to SET ORDER.
How to stay on current RecNo() after SET ORDER? If I use GRID_ARTIKLI.REFRESH, it moves on 1st record.
If I don't refresh, GRID_ARTIKLI isn't refreshed and doesn't show correct data.
Save RECNUM() to a variable before SET ORDER and after SET ORDER use GO command to activate that record. fe:

Code: Select all

nCurRec := RECNUM() 
SET ORDER TO X
GO TO nCurRec
Refresh...
IMO you have a bigger problem: You are using USE command at top of f_CATEGORY and f_artikli functions. Whenever one of this
two function called, USE command re-called and the table re-open and "current" record changed.

Instead you can,
- place all USE command in separate procedure (such as "OpenTables"),
- call this proc at beginning of application once, fe before defining any form;
- and then use simply SELECT command ( or SELECT() function for activate that table.

In other hand, instead of linking menu items, using TAB control for GRID of each table may be more convenient.

And a last point : Tree-Menu isn't better than Main-menu control.

Happy HMG'ing

Re: TREE control used as main menu - problems

Posted: Fri Aug 29, 2014 5:56 pm
by Javier Tovar
Hello Mr. Esgici saw the example of partner and you said it all!

greetings Master! :)

Re: TREE control used as main menu - problems

Posted: Fri Aug 29, 2014 10:11 pm
by andyglezl
Hola
Les parecerá raro, pero yo no había utilizado el CONTROL TREE...
Bueno, les dejo un DEMO tomando como ejemplo lo que posteó asacaric.
------------------------------------------------------------------------
Hi there
It will seem strange, but I had not used the TREE CONTROL ...
Well, I leave a DEMO as exemplified what asacaric posted.

Re: TREE control used as main menu - problems

Posted: Fri Aug 29, 2014 10:54 pm
by esgici
andyglezl wrote:... I had not used the TREE CONTROL ... .
Really :?: :o

You didn't see this yet :?:

Re: TREE control used as main menu - problems

Posted: Sat Aug 30, 2014 7:06 pm
by Javier Tovar
andyglezl wrote: but I had not used the TREE CONTROL ...
+1

:D