How to check if surrounding buttons are disabled - vb.net

I have an onscreen keyboard, if a user mistakenly types the wrong letter and presses backspace that letter/button is disabled.
I want to make it that if three buttons are pressed and deleted surrounding one button, it should make the inside button be pressed. This should only happen if the button is surrounded on three sides by mistake buttons.
1) The Size of the buttons change so I can't check with buttons locations
2) I can manually type in every possible combination, but I wanted to know if there is a quicker, and more concise way to write this?

One way to handle this is to have a link on each button to each of its neighbors. Left and right will be easy to initialize, but you may need to initialize vertical neighbors "manually" because of special cases. At run time, just use the links to check buttons.

Related

Movable objects around a wxPanel

In wxWidgets, I would like to have 2 objects on a wxPanel joined by a line and with a mouse down event to relocate the position of either of the 2 objects (The line should automatically be redrawn to follow the new position of the objects). I have tried using wxPaintDC to draw the initial position of the 2 objects (Custom created with mouse click events) and using dc.DrawLine to join these 2 objects together with a line. How should I proceed to allow make those 2 objects movable (mouse down event) along with the line? Can this even be achieve?
Of course it's possible (just about everything is, it's "only" a matter of effort), but it's not completely trivial and you may want to use OGL which does it for you. On the flip side, OGL is very old and completely unmaintained since a long time, so if your needs are really simple, it's probably still better to do it yourself.
If you do, here are some hints:
For mouse handling, you first need an (efficient if possible) hit testing function.
Once you have it, it's easy to detect where a click happens and what object is under it and start moving it if it makes sense. To be more user friendly, the move shouldn't start immediately, but wait until either the mouse moves a little, or stays pressed for some longer time (this will avoid accidental moves).
When the user is dragging the mouse you will get wxEVT_MOTION events. Use wxMouseEvent::Dragging() in your handler to check whether any mouse button is pressed.
Whatever you do, you must always draw from your wxEVT_PAINT handler, i.e. if an object moves, you must not redraw it immediately, but update its position, invalidate the area taken by it before and after the move (invalidating everything is simpler, but less efficient) and draw it from your OnPaint().
You want double buffering to avoid flicker, see wxAutoBufferedPaintDC

What technique will I use if i want to change this panel when I click a button in VB

I just have it in my mind. And I can't explain it so here it goes.
A system that only uses 1 form?
It have a two panel, left and right.
The left is consist of buttons
Then the right is associated on the buttons and will change whether what button will be clicked.
Any ideas?
My preference is to do this via custom controls, rather than panels... but panels can work too.
There are a number of ways to do this:
Keep all of the controls layered on top of each other, and then set the Visible property to false for controls/panels you don't care about and to true for the Control/Panel that you do
Move the controls you don't care about out of the visible area
Remove/Add the Controls/Panels from Form's controls collection entirely
I think you can also get a TabControl to put the tabs along the left side, with some formatting that looks more like buttons, such that what you want will be handled without needing to write any code to switch layouts
Any of those can work. Whichever option you use, I have two recommendation for controlling layout and making the transitions smooth.
Call SuspendLayout() before making any changes, and then call ResumeLayout() when you're done. This will help avoid stuttering or a partially rendered form.
Look at the TableLayoutPanel Control. This control will allow you to arrange your top-level panels so that they can be resized with proportion. If you also then dock your individual panels, you can quickly build your program so that it resizes correctly.
You can have several panels, one on top of another. Change their visibility, depending on which one you need at a given moment.
Option #2 would be using a vertical tab control (or a tab strip - see another answer there).

Selecting Multiple Buttons by Sliding Finger Over Them

I'm trying to make it so that the buttons I have are selected whenever a finger passes over them on the screen. These buttons were added with fast enumeration (there are 20 of them), so I'm unsure of how exactly to do this.
There are various different properties on UIButton that you can use to achieve this. In particular what comes to mind is the isHighlighted and isSelected properties of the button. These are states on the button that you can manipulate to achieve the visual solution, and disable and enable the buttons as you want to make them press-able by the user. Also be sure to use the correct UIControlState you want. As in TouchUp, TouchDown etc...

Adding drag and drop functionality to metro style app buttons with C# and XAML

I'm trying to implement a sort of drag functionality into my app. As a simplistic example imagine I have a 2x2 square of buttons, so four buttons total. Clicking a button will perform some other functionality however I want when they hold and drag one of these buttons for it to do something else (ideally if you drag one button and drop it while in the space of another button the two buttons will swap places, as long as I can get dragging and dropping working the swap should be easy).
I've done some research and followed a few tutorials but seemed to get errors at one step or another with all of those. It seems ListViews and GridViews have some drag and drop functionality in them already , but I had trouble properly arranging my buttons (there are many more than four and they are in very specific positions, like a diagram) inside these views, let alone getting drag and drop working with them.
How would I go about doing this? Ideally I could just tag these buttons as draggable, and then on a drag-drop event check for a drop position, then if the position is valid perform a swap method. I just can't seem to figure out how to make them draggable or how to have an event that checks a drop position.
Thanks.
Easy peasy, create a custom control that looks the way you want it to, set ManipulationMode to TranslateX|TranslateY, handle manipulation delta events to update positioning with something like a Canvas or TranslateTransform and when manipulation completes - either make it click or animate to the new position. From my experience - getting any other manipulations to work with a regular Button class just isn't working and since a button is a really simple control - it is easier to create your own than try to extend the existing one in such cases.

Prevent split of the keyboard and block it

Can I use UIKeyboardWillChangeFrameNotification to prevent the user to change the keyboard layout? I've some buttons on it and I don't want the splited keyboard, because it creates some ui problems.
Thank you in advance.
No, you have no control over the behavior of the system keyboard. Your only real option is to make your UI work properly with the split one. Keep in mind, though, that since the split keyboard can be moved, it doesn’t matter if it’s covering parts of your interface—if the user splits their keyboard, moving it out of the way of what they’re trying to interact with then becomes their problem.