Partial clear screen

Moderator: Rathinagiri

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

Partial clear screen

Post by asharpham » Tue Apr 03, 2018 4:17 pm

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: 382
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 111 times
Been thanked: 278 times

Post by edk » Tue Apr 03, 2018 5:09 pm

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: 320
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 64 times
Been thanked: 44 times

Post by Anand » Tue Apr 03, 2018 5:41 pm

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
Image

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

Post by asharpham » Wed Apr 04, 2018 3:53 am

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
Has thanked: 14 times

Post by asharpham » Wed Apr 04, 2018 3:59 am

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: 5250
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 167 times
Been thanked: 165 times
Contact:

Post by Rathinagiri » Wed Apr 04, 2018 4:36 am

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
Has thanked: 14 times

Post by asharpham » Wed Apr 04, 2018 8:11 am

After making a TEXTBOX invisible, can I use the same space for a different TEXTBOX for a different purpose?

User avatar
Anand
Posts: 320
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 64 times
Been thanked: 44 times

Post by Anand » Wed Apr 04, 2018 10:03 am

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 591 times
2018-04-04_152628.jpg
2018-04-04_152628.jpg (107.04 KiB) Viewed 591 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
Image

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

Post by asharpham » Fri Apr 06, 2018 4:56 am

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: 5250
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 167 times
Been thanked: 165 times
Contact:

Post by Rathinagiri » Fri Apr 06, 2018 5:13 am

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