Page 1 of 2

Partial clear screen

Posted: Tue Apr 03, 2018 4:17 pm
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

Re: Partial clear screen

Posted: Tue Apr 03, 2018 5:09 pm
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

Re: Partial clear screen

Posted: Tue Apr 03, 2018 5:41 pm
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

Re: Partial clear screen

Posted: Wed Apr 04, 2018 3:53 am
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

Re: Partial clear screen

Posted: Wed Apr 04, 2018 3:59 am
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?

Re: Partial clear screen

Posted: Wed Apr 04, 2018 4:36 am
by Rathinagiri
It can be done at anywhere with the following:

windowname.textboxname.visible := .f.

Re: Partial clear screen

Posted: Wed Apr 04, 2018 8:11 am
by asharpham
After making a TEXTBOX invisible, can I use the same space for a different TEXTBOX for a different purpose?

Re: Partial clear screen

Posted: Wed Apr 04, 2018 10:03 am
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 4073 times
2018-04-04_152628.jpg
2018-04-04_152628.jpg (107.04 KiB) Viewed 4073 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

Re: Partial clear screen

Posted: Fri Apr 06, 2018 4:56 am
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

Re: Partial clear screen

Posted: Fri Apr 06, 2018 5:13 am
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.