TREE control used as main menu - problems

Issues and Discussions related to Harbour

Moderator: Rathinagiri

User avatar
asacaric
Posts: 9
Joined: Mon May 05, 2014 1:12 pm
Location: Croatia

TREE control used as main menu - problems

Post 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!
Attachments
OBRADE.zip
(13.34 KiB) Downloaded 294 times
Last edited by asacaric on Fri Aug 29, 2014 2:44 pm, edited 1 time in total.
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: TREE control used as main menu - problems

Post 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
User avatar
Agil Abdullah
Posts: 204
Joined: Mon Aug 25, 2014 11:57 am
Location: Jakarta, Indonesia
Contact:

Re: TREE control used as main menu - problems

Post 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
Agil Abdullah Albatati (just call me Agil)
Programmer Never Surrender
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: TREE control used as main menu - problems

Post 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 :( )
Attachments
ART&CAT.zip
slightly modified version of two .prg files of OBRADE project
(1.84 KiB) Downloaded 276 times
Viva INTERNATIONAL HMG :D
User avatar
asacaric
Posts: 9
Joined: Mon May 05, 2014 1:12 pm
Location: Croatia

Re: TREE control used as main menu - problems

Post 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.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: TREE control used as main menu - problems

Post 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
Viva INTERNATIONAL HMG :D
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: TREE control used as main menu - problems

Post by Javier Tovar »

Hello Mr. Esgici saw the example of partner and you said it all!

greetings Master! :)
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: TREE control used as main menu - problems

Post 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.
Attachments
TreMenuDemo.jpg
TreMenuDemo.jpg (253.34 KiB) Viewed 5892 times
MenuTreeDemo.rar
(430.21 KiB) Downloaded 354 times
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: TREE control used as main menu - problems

Post by esgici »

andyglezl wrote:... I had not used the TREE CONTROL ... .
Really :?: :o

You didn't see this yet :?:
Viva INTERNATIONAL HMG :D
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: TREE control used as main menu - problems

Post by Javier Tovar »

andyglezl wrote: but I had not used the TREE CONTROL ...
+1

:D
Post Reply