Author |
Topic: Rendering some controls invisible? (Read 828 times) |
|
g3nrw
Junior Member
member is offline


Posts: 74
|
 |
Rendering some controls invisible?
« Thread started on: Dec 20th, 2014, 11:02am » |
|
I have an app where, depending on a certain logical state, I want to render a few controls invisible (because they don't apply to the current situation).
The pseudo-BASIC would look something like this:
Code:
PROC_static(dlg%,"labeltext", ....)
PROC_combobox(dlg%, "", .....)
PROC_showdialog(dlg%)
IF somevalue = TRUE THEN
REM: Code to make the label and combox invisible
ENDIF
What code do I need to make this do-able?
So far I have only been able to disable the controls. Then they aren't usable, but they are still visible. It would look much better if they weren't visible at all.
-- Ian
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: Rendering some controls invisible?
« Reply #1 on: Dec 20th, 2014, 12:07pm » |
|
on Dec 20th, 2014, 11:02am, g3nrw wrote:I want to render a few controls invisible... What code do I need to make this do-able? |
|
It may be that I haven't properly understood your requirement, but doesn't simply removing the WS_VISIBLE style bit (&10000000) achieve exactly that?
All windows are initially created invisible, unless that style bit is set, although of course the BB4W libraries (e.g. WINLIB2) always set it by default because it's the most common requirement.
If that doesn't do what you want, explain in more detail what you want to achieve.
Richard.
|
|
Logged
|
|
|
|
g3nrw
Junior Member
member is offline


Posts: 74
|
 |
Re: Rendering some controls invisible?
« Reply #2 on: Dec 20th, 2014, 3:13pm » |
|
Richard
In the "code" snippet, I defined the two controls, *then* displayed the dialog box, and only *then* wanted to make the controls invisible. Surely I can't define the controls again after displaying the dialog box, this time making them invisible?
-- Ian
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: Rendering some controls invisible?
« Reply #3 on: Dec 20th, 2014, 3:52pm » |
|
on Dec 20th, 2014, 3:13pm, g3nrw wrote:I defined the two controls, *then* displayed the dialog box, and only *then* wanted to make the controls invisible. |
|
I didn't spot that. Sorry.
Whenever I've done something similar, I've always had some controls which needed to be initially invisible and some which start off being visible and are subsequently made invisible. In that situation it's better to remove the WS_VISIBLE style bit rather than to hide the controls, because even if you hide them immediately after the PROC_showdialog there is a risk that you might see them 'flash' briefly - and almost invariably it only happens on somebody else's system!
If none of your controls need to be hidden initially then that obviously isn't a problem, and you can subsequently hide and show them using ShowWindow in the usual way without any unwanted glitches (the ShowWindow API is documented in the BB4W help and searching for 'hide' finds it).
Richard.
|
« Last Edit: Dec 20th, 2014, 4:06pm by rtr2 » |
Logged
|
|
|
|
|