fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: wpf

wpf 2 months 4 weeks ago #1

Hi all,
somebody will be advised how to change the focus between texboxs in the wpf window using the arrows up or down???

Please Log in or Create an account to join the conversation.

wpf 2 months 4 weeks ago #2

  • wriedmann
  • wriedmann's Avatar
  • Offline
  • Posts: 1491
  • Karma: 6
Hi Juraj,

I'm working a lot with WPF, but have never arrived at the point to need this.
And currently I have no idea how to accomplish this. With subclassed controls it should be possible, but currently I have not the time to try it.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

wpf 2 months 4 weeks ago #3

Hi Juraj

If I've understood your problem correctly I'm a bit surprised because it should be something that happens automatically in WPF.

However it may be worth checking that the Focusable Properties on your Textboxes are set to true.

Just a guess.

Terry

Please Log in or Create an account to join the conversation.

wpf 2 months 4 weeks ago #4

HI Wolfgang

Thanks for the reply. I am working on a library application, for processing statistics. Their requirement is to move the form using the arrows (up or down), and the numeric values ​​are in the "99 999 999.99" format. I think it will be a tough job if I want to do it at the WPF

Juraj

Please Log in or Create an account to join the conversation.

wpf 2 months 4 weeks ago #5

Hi Terry and all

Please Log in or Create an account to join the conversation.

wpf 2 months 4 weeks ago #6

I want to use something like sendkey in winforms.
I found an example for wpf but it is in c# and i can not convert it to x#.


public static class SendKeys
{
public static void Send(Key key)
{
if (Keyboard.PrimaryDevice != null)
{
if (Keyboard.PrimaryDevice.ActiveSource != null)
{
var e1 = new KeyEventArgs(Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, 0, Key.Down) { RoutedEvent = Keyboard.KeyDownEvent };
InputManager.Current.ProcessInput(e1);
}
}
}
}

Please Log in or Create an account to join the conversation.

wpf 2 months 3 weeks ago #7

Hi Juraj

Sorry but I am not the best person to advise on the XSharp side of things.

But I have used WPF. I am more of a C-Sharper looking in, still using old/fading memories of VO.

That being said, using WPF is quite a hurdle to jump as I think you recognise when you say "it will be a tough job." Tough jobs take time and there is no way round this.

FWIW and all the complexity of WPF (and learning to use it), it is a well engineered, comprehensive and powerful bit of software which takes care of almost everything automatically. Trying to get into it via Keyboard Events may not be the best way to start.

I still really don't fully understand what you're trying to do. You talk of a "library application to process statistics".

I can only guess that you are trying to present large amounts of numerical data in a meaningful and easy to understand way - Bar Charts, Pie Charts and so on. To do that you'd certainly need WPF and it would take some time.

Sorry I can't give more specific XSharp advice.

Terry

Please Log in or Create an account to join the conversation.

wpf 2 months 3 weeks ago #8

Hi Terry,
I agree. I have gone from programming in Clipper 87 and Clipper 5 in MS DOS, with the arrival of Windows I went to Visual Objects and later Vulcan Net, who taught me to use Visual Studio. I welcomed the emergence of XSharp, which we will be able to program in .Net. I am fortunate that I do not have to migrate old applications from VO, because I used more 3rd products and it would be complicated. Already in Vulcan Net, I tried to write new applications with minimizing VO dialects. I've run a few Vulcan apps to XSharp applications without any problems, of course in WinForms. But I'm programming new applications in the WPF and Core dialects, because I also think it's my future. I make customized programs, small applications according to clients' requirements. I try to meet their requirements. That's why I want to program a form in which you can move with the arrows. A lot of numeric data is populated, so the input from the keyboard is preferred. Older clients have a little trouble using TAB and Shift + Tab while moving in a form.
I never programmed in C #, just recently I imported a few short examples that were written in cs. I managed to rewrite them to xs, only with this last I fail. I want you to emulate the tab keystrokes after the down arrow down or up the program.
Finally, I would like to congratulate myself on my English. I'm from the generation that learn Russian in the eastern block.

Please Log in or Create an account to join the conversation.

wpf 2 months 3 weeks ago #9

Hello Juraj,

I've got 2 pieces of WPF code which may help:

In the XAML I have this:

<TextBox Name="ttPagina" Height="25" Width="37" MaxLength="3" TextChanged="TextBox_ttPaginaChanged"/>
So I have a method which is called when something is typed in a box. Not sure if it works with cursor keys, but I can use + and - to browse pages on our Teletekst browser, and type 3 digit page numbers after which the page is opened without the need to press enter:
METHOD TextBox_ttPaginaChanged(sender AS OBJECT, e AS System.Windows.Controls.TextChangedEventArgs) AS VOID

which is like the EditChange from VO.

I start with this:

IF !SELF:lTxtBoxUpdated // This method just updated a message and hence directly runs again do NOT set lDoNotUpdateTxt to false to keep the above message in view
lDoNotUpdateTxt:=FALSE // Init: update status
ELSE
lDoNotUpdateTxt:=TRUE // do NOT update status
SELF:lTxtBoxUpdated:=FALSE // and reset for future use
ENDIF
cText :=Upper(AllTrim(SELF:ttPagina:text))

and then I can react on any key typed in.

Next thing you may want to test is:

PRIVATE METHOD ttBrowser_Navigating(sender AS OBJECT, e AS System.Windows.Navigation.NavigatingCancelEventArgs) AS VOID
//#s Set up in Webbrowser define in XAML and called when a hyperlink is clicked 12-12-2014

We use that in the webbrowser to catch hyperlinks and act upon it, like this:
<WebBrowser x:Name="ttBrowser" Navigating="ttBrowser_Navigating"
but I would say you could do that on any control.

Hope it helps a bit.

Dick

Please Log in or Create an account to join the conversation.

wpf 2 months 3 weeks ago #10

Hi Juraj

I understand and think you have chosen the right path for your career development. It would have been the same path I would take myself if starting out now.

VO represented a brilliant bit of foresight on the part of its developers, who saw a way of removing the need for Application Developers to concern themselves with the underlying electronic technology.

Things move on. Now, and I am talking right up to date, 2019, we are in a position where we can change all aspects of what our application programs can do independently without having to re-write everything from the ground up.

We can produce programs which are effectively FUTURE PROOF.

In no area is this more important than the "Business Application Area" i.e. XSharp target.

Business requirements overall can change quickly. (At the drop of a hat!)

Re-writing thousands of lines of code, simply because this wasn't foreseen when the application was first structured, is out of the question.

Now the logic to do this has been made possible by Microsoft. It is possible because of the programmability of the re-imagined Roslyn compilation process and can be applied to any program using Roslyn-based compilation.

At this time, in the C# world, this tends to be explained and implemented by manual code modification (a lot of learning / time). My guess is that software tooling to simplify the whole process will emerge and XSharp apps will benefit.

Terry

Please Log in or Create an account to join the conversation.

wpf 2 months 3 weeks ago #11

Hello Juraj,

This is probably exactly what you need:

docs.microsoft.com/en-us/dotnet/framewor...he-enter-key-pressed

You define the method to be called in the XAML code of the control and the called C# method is only a few lines is easy to convert to X#. Note that you can also add a C# project to your solution and call the C# methods as if they are written in X# - without the need to convert anything, should you encounter a more complicated but working C# method somewhere.

Dick

Please Log in or Create an account to join the conversation.

wpf 2 months 3 weeks ago #12

Hello Dick,
Thank you for your good pleasure. I have no problem to check which key was pressed, the problem was to emulate press Tab or Shift + Tab. I found one solution that fits my application. It was also in C#, but I managed to convert it to XSharp. Be sure to use your advice in the future.

Juraj

Please Log in or Create an account to join the conversation.

  • Page:
  • 1