Variables and Definition Errors

Moderator: Rathinagiri

asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

Variables and Definition Errors

Post by asharpham »

Hi all. I wasn't sure how to word a search enquiry for this one so I thought I'd post something here in the hope I can be put on the right track.

I have created an input screen using LABELs and TEXTBOXes. A number of variables have been applied to the expected entries. I want to save the results of the input to a database and then reload the empty TEXTBOXes ready for the next entry.

Initially I'd be happy if someone could guide me towards how to reuse the TEXTBOXes without closing the entry screen and reloading it. If there is a SAMPLE someone knows of I'd be happy to work through it.

To link this enquiry with the subject, I've been getting errors relating to the definitions of LABELs, BUTTONs & Variables that have already been defined. I've added a "RELEASE ALL" command but the program won't run yet because of other errors I'm working through.

I've been hesitant to upload the source because it is a fair size but will zip it and upload it if you need me to.

Regards,
Alan
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Variables and Definition Errors

Post by Rathinagiri »

Hi Alan,

Can you make a small sample with the errors you are getting?

You can also share the error logs.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Variables and Definition Errors

Post by esgici »

asharpham wrote: Sat Mar 31, 2018 6:51 am ... I've been getting errors relating to the definitions of LABELs, BUTTONs & Variables that have already been defined.
...
Hi Alan

Control names are public variable throughout project and they should be unique;

so you need give name to they like this way:

@ ..., ... BUTTON MyButton_1 ...
@ ..., ... BUTTON MyButton_2 ...

instead of :

@ ..., ... BUTTON MyButton ...
@ ..., ... BUTTON MyButton ...

This may be your problem.

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

Re: Variables and Definition Errors

Post by asharpham »

I would, Rathinagiri, but I can't see how to upload a file. And esgici, my problem is I need to reuse the buttons and labels on the screen but because they have already been defined, I'm not allowed to. It's more of a screen layout issue so I don't mind releasing the values and reapplying them, as long as the screen looks the same and the same variables can accept new values. By the way, a little off topic (very off topic acutally), I loved some of the Turkish TV programs available on Netflix in Australia, with English subtitles of course!

Alan
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Variables and Definition Errors

Post by dragancesu »

Look atachment program in topic Indexing DBF
It's all what you need
asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

Re: Variables and Definition Errors

Post by asharpham »

Dragan, I can see that you uploaded a zip file but I can't see how you did it. I can't find anything to click on to allow a file upload.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Variables and Definition Errors

Post by esgici »

asharpham wrote: Sat Mar 31, 2018 8:41 am ... I need to reuse the buttons and labels on the screen but because they have already been defined, I'm not allowed to.
...
Sadly we can't change rules posed by compiler and libraries :(
I loved some of the Turkish TV programs available on Netflix in Australia, with English subtitles of course!
I'm glad that 8-) good watch:)

Viva HMG :D
Viva INTERNATIONAL HMG :D
ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

Re: Variables and Definition Errors

Post by ROBROS »

Hi,

Serge Girard provided the following code for me, it should solve your problem:

Code: Select all

function weiter

SetProperty('Del_1', 'Grid_1','Visible', .F.)
go Del_1.Grid_1.RecNo
cPERSNR := bbpers->persnr
cNAME := bbpers->name
cVname:= bbpers->vname
SetProperty('Del_1', 'Grid_1','Visible', .T.)
Del_1.Grid_1.SetFocus

   IF IsControlDefined ('X1' , 'Del_1' )  
      DoMethod ('Del_1' , 'X1' , 'Release' )
   ENDIF

   IF IsControlDefined ('X2' , 'Del_1' )  
      DoMethod ('Del_1' , 'X2' , 'Release' )   
   ENDIF

   IF IsControlDefined ('X4' , 'Del_1' )  
      DoMethod ('Del_1' , 'X4' , 'Release' )   
   ENDIF
   
   aKZ:={'N','J'}

DEFINE TEXTBOX    X1
   PARENT         Del_1
   ROW            850
   COL            10
   WIDTH          200 
   HEIGHT         25
   VALUE          cPERSNR+' '+alltrim(cNAME)+' '+alltrim(cVname)
   FONTCOLOR      BLACK   
   TOOLTIP        '  '
   TABSTOP        .T. 
   READONLY       .T.
END TEXTBOX

DEFINE COMBOBOX   X2   
   PARENT         Del_1
   ROW            850
   COL            340
   WIDTH          60 
   ITEMS          aKZ
   VALUE          1
   on enter weiter()
END COMBOBOX 
If the control is already defined, you simply release it and now you can define it again.
Regards Robert
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Variables and Definition Errors

Post by edk »

asharpham wrote: Sat Mar 31, 2018 9:32 am Dragan, I can see that you uploaded a zip file but I can't see how you did it. I can't find anything to click on to allow a file upload.
1.png
1.png (5.32 KiB) Viewed 3106 times
2.png
2.png (45.38 KiB) Viewed 3106 times
3.png
3.png (45.66 KiB) Viewed 3106 times
asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

Re: Variables and Definition Errors

Post by asharpham »

Thanks again people. I certainly feel very slow tonight. I haven't been using the full editor today so that's how I missed it.
Music_Lib.7z
(2.7 KiB) Downloaded 183 times
This program is unfinished so not all of the menu buttons work. It loads the main menu and loads "Add New Music" but none of the other menu items work, as well as the 3 buttons at the bottom. Some of the labels aren't displaying properly either but I know I can fix that as I work on it.

I want to create code that will respond if the first box is left empty. I'm not sure how to code it so that each time there is a response to a textbox, the value of the variable is assessed and an action taken before moving on to the next textbox.

I don't need anyone to work on the rest of it as I want the exercise of doing it myself so I can learn. But if I can get some pointers on this "Add" menu item, that should help me.

Thanks again everyone.

Alan
Post Reply