Partial clear screen

Moderator: Rathinagiri

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

Partial clear screen

Post by asharpham »

I want to clear part of my screen but the old Clipper way of doing it doesn't work. I have 2 buttons at the bottom of my window that appear when I click the "Search" button in the TOOLBAR. I want them to disappear when I leave the "search" module without afffecting the rest of the screen.

I read about the "INVISIBLE" mode for buttons but this doesn't help as I want the buttons to remain visible during the "search" process and then have them disappear once I've finished searching. They need to gone, not just invisible.

Any help would be appreciated.

Regards,
Alan
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Partial clear screen

Post by edk »

IMO the better solution will be to disable the availability of the button and then re-enable availability.

Code: Select all

<WindowName>.<ButtonName>.Enabled := .F.  //disable button
<WindowName>.<ButtonName>.Enabled := .T.  //enable button
You can also hide and show:

Code: Select all

<WindowName>.<ButtonName>.Hide
<WindowName>.<ButtonName>.Show
Last edited by edk on Tue Apr 03, 2018 8:20 pm, edited 1 time in total.
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

Re: Partial clear screen

Post by Anand »

Hi Alan,

First difference between dos clipper and win hmg is that in clipper you draw on screen but hmg (similarly in VB, C# etc.) you create object and show/hide it.

In clipper we have get object, but there is no say or button objects. In hmg we have get/say/button etc. objects. Since objects use memory we create once and show/hide them as required.

As Edk suggested, .hide and .show should solve your requirement.

Regards,

Anand
Regards,

Anand

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

Re: Partial clear screen

Post by asharpham »

Thanks guys. Part of my problem is I have never worked with Windows before so am still getting used to terminology and best practice. Your suggestions are very helpful and I'll put them to use. Do Textboxes work the same way or do you use the Visible option?

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

Re: Partial clear screen

Post by asharpham »

No actually I'm stuck on the "Visible" idea. I can see that "Visible .T." can be included as one of the options when defining a TEXTBOX but then how do you change it to "Visible .F." outside of the definition?
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: Partial clear screen

Post by Rathinagiri »

It can be done at anywhere with the following:

windowname.textboxname.visible := .f.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

Re: Partial clear screen

Post by asharpham »

After making a TEXTBOX invisible, can I use the same space for a different TEXTBOX for a different purpose?
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

Re: Partial clear screen

Post by Anand »

Hi Alan,

I suggest you try HMG\SAMPLES\Basics\MAIN_DEMO\
When you press "SetValue" button, you will note that the label (say in clipper), textbox (get in clipper) has changed.
See screen shot attached.

2018-04-04_152606.jpg
2018-04-04_152606.jpg (104.97 KiB) Viewed 4022 times
2018-04-04_152628.jpg
2018-04-04_152628.jpg (107.04 KiB) Viewed 4022 times

So basically we do not use different textbox in same space, but change the value of the textbox and use the same object. Though you can create a new textbox in same place and it will work, but not advised for memory sake.

Regards,

Anand
Regards,

Anand

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

Re: Partial clear screen

Post by asharpham »

Okay I checked the MAIN_DEMO sample and it has some great examples and is very helpful. So I tried the option to hide part of my screen using exactly the same process from the sample but it didn't work.

The sample code is:
*-----------------------------------------------------------------------------*
Procedure Hide_CLick
*-----------------------------------------------------------------------------*

Form_1.Image_1.Visible := .f.
Form_1.Spinner_1.Visible := .f.
Form_1.Tab_1.Visible := .f.

Return Nil


and my code is:
PROCEDURE HideButtons

Library_1.SeekButton.Visible := .F.
Library_1.QuitSearch.Visible := .F.
Library_1.Seek1.Release

RETURN


The only difference I can see is RETURN instead of RETURN nil. But the sample works and mine doesn't. Is there a setting somewhere else that needs to be invoked?

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: Partial clear screen

Post by Rathinagiri »

Alan,

There is nothing wrong in your coding.

GUI is totally based on Events. These procedures are hooked to various events.

You have to hook the above procedure 'HideButtons' to any event like Clicking a button/Pressing a Key/Mouse Click/Scroll or whatever. Then, whenever that event happens your procedure is called upon.

Can you show where and how the above procedure have been hooked? Or, please show the whole sample.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply