Announcement

Collapse
No announcement yet.

how to make an active button invisible in a dialog?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stuart McLachlan
    replied
    Originally posted by Travis Siegel View Post
    Stopping use of the tab key in your app is most definitely *not* what you want to do..
    He didn't ask about disabling the tab key for the application.
    He just wanted to "disable the tab keys for this hidden button"
    IOW, he did not understand the effect of the %WS_TABSTOP style in his code.


    Leave a comment:


  • Travis Siegel
    replied
    Stopping use of the tab key in your app is most definitely *not* what you want to do. There are folks who (for various reasons) don't use a mouse. In some cases, it's because they're using a screen reader because they can't see the screen. In that caxe specifically, and other cases in general, removing keyboard navigation of an app can make it completely inaccessible, and unusuable to many folks. Plus, there are folks who do use a mouse, but resort to keyboard usage to make things faster. It's way faster to press a key or two then to move the mouse all over the screen especially if it's being used for something that requires the mouse to be somewhere else on the screen when they wish to accomplish something else. There's all kinds of reasons *not* to disable the tab key. But, it's your program, and you can do with it what you like, but just for reasonable advice, one should *never* disable the tab key, as it's an essential tool for many users.

    Leave a comment:


  • Borje Hagsten
    replied
    Quick look at your code shows you create a "hidden" button with %WS_CHILD OR %WS_TABSTOP OR %BS_OWNERDRAW style. Remove %WS_TABSTOP so it only has %WS_CHILD OR %BS_OWNERDRAW styles and tabbing to next control problem will be solved.

    Added - another tip could be to add %MB_TOPMOST style to MSGBOX, so it doesn't end up under dialog 2 there in some cases, like %MB_OK OR %MB_TOPMOST.

    Added 2: But like others have replied - easier and best way is via message directly, instead of hidden button. I just wanted to show how to fix tab-to-control problem.

    Leave a comment:


  • Dale Yarker
    replied
    I want to stop User from using the Tab key !
    Again from multiple sources, DO NOT USE A BUTTON or any kind of control.

    1. Send/post a WM_COMMAND message with an ID, but do not use CONTROL ADD with that ID in dialog 1. A control does not need to exist to catch ID in callback. WParam and LParam are used.

    2. Send/post a WM_User + 500 message, WParam and LParam are available.

    3. Send/post a WM_App message, WParam and LParam are available.

    see Help or MSDN for difference between SEND and POST.

    2. or 3. make more sense.

    Leave a comment:


  • Pierre Bellisle
    replied
    Tim, if your goal is to send a message to another program, you don't need a control to receive it.
    Just send the message to %WM_APP (or %WM_APP + 1, +2, +3, etc)
    In bonus, you can pass two parameters.

    There is many ways, one other is RegisterWindowMessage() to define a "private" unique message

    Code:
    PostMessage(hOtherProgram, %WM_APP, 123, 456)
    In OtherProgram:
    Code:
     CALLBACK FUNCTION DlgProc() AS LONG
       SELECT CASE CBMSG
         CASE %WM_APP
           MessageBox(hDlg, "Message from space" & STR$(CBWPARAM) & STR$(CBLPARAM), "OtherProgram", %MB_OK OR %MB_TOPMOST)

    Leave a comment:


  • Stuart McLachlan
    replied
    Originally posted by Tim Lakinir View Post
    WS_TABSTOP window style.
    Specifies a control that can receive the keyboard focus when the user presses Tab. Pressing Tab changes the keyboard focus to the next control with the WS_TABSTOP style

    this WS_TABSTOP window style is not suitable for my hidden button as it allow for user to push theTab key to navigate around all the controls one by one

    I want to stop User from using the Tab key !

    anything to disable the Tab key ? how to trap the Tab key ? what message is used to trap the tab key

    Look at the style& description under CONTROL ADD BUTTON!!

    Leave a comment:


  • Steve Hutchesson
    replied
    I have not digested all of the nuances of this topic but making an invisible button seems to be redundant in that you can send or post a message to you WM_COMMAND processing and save yourself the extra work and complexity.

    Leave a comment:


  • Tim Lakinir
    replied
    WS_TABSTOP window style.
    Specifies a control that can receive the keyboard focus when the user presses Tab. Pressing Tab changes the keyboard focus to the next control with the WS_TABSTOP style

    this WS_TABSTOP window style is not suitable for my hidden button as it allow for user to push theTab key to navigate around all the controls one by one

    I want to stop User from using the Tab key !

    anything to disable the Tab key ? how to trap the Tab key ? what message is used to trap the tab key






    Leave a comment:


  • Michael Mattias
    replied
    is there a button style that can prevent the usage of a tab key ?
    See: WS_TABSTOP window style. Use of WS_GROUP style can also affect but only for certain styles of button.

    (Yes I am making you look it up!)

    Leave a comment:


  • Tim Lakinir
    replied
    Thank you Everyone, the use of the Hidden button ( or invisible) is a proof of concept and it will be hidden from users so that it is NOT accessible to them but it can only be
    access by a button in another program ( this is to prove Process communication ).

    Thank you Borje, yes the Hidden button is still be accessible by the tab tab tab keystrokes, and that this must be prevented.
    In this issue, how can I disable the tab keys for this hidden button ? is there a button style that can prevent the usage of a tab key ?

    Leave a comment:


  • Borje Hagsten
    replied
    Remember that buttons moved to be "hidden" also may be reachable via the keyboard. Tab-tab-tab...
    And that some users actually prefer to work via keyboard only. Fast keyboard shortcuts should always exist.
    Sometimes using an accelerator key + info about it can be a good solution. See PB help, ACCEL ATTACH.

    Leave a comment:


  • Michael Mattias
    replied
    If it is entirely programmatic, then you do not need an actual control. All you need is an ID.

    You don't even need that.

    Methinks young Mr. Lakinir is looking for the hard way to accomplish something.

    Search here (or elsewhere) for "interprocess communication" and you'll probably find double digits worth of ways to do it.

    Leave a comment:


  • Dale Yarker
    replied
    If this is to do with your other thread where you want to cause an action by triggering a button click from another application, you may like to re-think your solution.
    . . . I cannot see how that makes sense.
    If it is entirely programmatic, then you do not need an actual control. All you need is an ID.
    You do not need a hidden button! The button in program2 can
    DIALOG POST hDialog1, %WM_User + 501, 0, 0
    In callback for dialog1
    SELECT CASE CB.MSG
    CASE %WM_User + 501
    'code you want

    If you need to do multiple things you've still got wParam and lParam and %WM_User + 502, etc.

    Leave a comment:


  • Tim Lakinir
    replied
    Hi Kurt, this hidden button is being implemented in my source code at https://forum.powerbasic.com/forum/u...ode#post817848

    The hidden button is located in ProgDlg1.bas in that post. It is clickable programatically by the other program ProgDlg2.bas's button , it is use to show how 2 programs can communicate via Process Memory technique.

    The hidden button is not clickable by human but can be clickable by another program ( proof of concept) , it is invisible and out of view of the hosting program's window. thus explains why I adopted the hidden button coordinates of - 10 , 265 in the ProgDlg1.bas

    Also check out the button named "Test Hidden ProgDlg1 btn" on ProgDlg2.bas which is used to semi programatically click the hidden button of ProgDlg1

    Leave a comment:


  • Kurt Kuzba
    replied
    Originally posted by Tim Lakinir View Post
    Thank you Stuart, I have set the button coordinates to - 10 , 265 that is outside the program's window
    This is seemingly about a control that has no physical manifestation.
    How will this control be accessed, if not by direct uses interactions?
    If it is entirely programatic, then you do not need an actual control.
    All you need is an ID.
    You can post a message that will activate the control, as though it had a windows object attached.
    Your callback doesn't care if the control is real or visible, of course. It just processes the control number.

    Leave a comment:


  • Michael Mattias
    replied
    is there some style to add to a control ( eg. a button) to make it invisible but still active and clickable?
    "clickable" but you cannot see it?

    Call me simple minded but I cannot see how that makes sense.

    But FWIW ...my very first Windows/32 posted code here...

    PB DLL 5 or 6: A game for you September 22, 1999

    It's a related concept.

    Leave a comment:


  • Tim Lakinir
    replied
    Thank you Stuart, I have set the button coordinates to - 10 , 265 that is outside the program's window

    Leave a comment:


  • Stuart McLachlan
    replied
    If this is to do with your other thread where you want to cause an action by triggering a button click from another application, you may like to re-think your solution.

    What happens when a user unknowingly clicks on this anonymous part of your application window?
    Do you want the user to activiate the on_click code accidentally by some random click when trying to re-activate/regain focus on the application?

    If not, there are alternative solutions which don't have this risk.
    The simplest is probably to just set the button's location outside of the bounds of the application window (negative x andy's are good for that.)

    Leave a comment:


  • Tim Lakinir
    replied
    Thank you Steve that works out

    Leave a comment:


  • Steve Hutchesson
    replied
    Tim,

    I think the BS_OWNERDRAW style does it for you. Create a button with that style and place it where you know where it is on the client area, then with a normal WM_COMMAND message processing, see if it works by clicking within that location.

    Leave a comment:

Working...
X