Welcome, Guest
Username: Password: Remember me

TOPIC:

Beginners Example 22 Jan 2021 17:14 #17266

  • ulli25


  • Posts: 4
  • Hello,
    is there a video or a visual studio (2019? community) project for a novice?
    Just to have an idea where and how to start.
    Reading a simple table (dbf) and showing result in GRID on screen or similar.

    Thank you.

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

    Beginners Example 24 Jan 2021 15:05 #17284

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2836
  • Hi Ulli,
    unfortunately I don't know FoxPro, so I cannot help you directly.
    Do you have looked in the YouTube channel?
    www.youtube.com/channel/UCFqLBMKPPxlN24xRxFGLiVA
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Beginners Example 24 Jan 2021 21:06 #17285

    • ulli25


  • Posts: 4
  • Thank you Wolfgang.
    Yes I have. Got the simple console app to work.

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

    Beginners Example 25 Jan 2021 18:33 #17288

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2836
  • Hi Ulli,
    since nobody seems to have a sample for you, maybe I have to search one for you.
    But I don't work in Visual Studio, but I prefer XIDE.
    Would be a sample using a Windows Forms DataGrid enough?
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Beginners Example 25 Jan 2021 19:52 #17291

    • ulli25


  • Posts: 4
  • Hi Wolfgang,
    I would try my very best to learn from it and make it work on my computer.
    I have already downloaded XIDE.
    There is no time pressure. I just found XSharp by chance and I think it is a great idea.
    So if you would do that I would very much appreciate your effort.
    Thank you in advance.

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

    Beginners Example 25 Jan 2021 20:00 #17292

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2836
  • Hi Ulli,
    as I wrote: I'm from the VO community, and therefore my knowledge of the VFP logic is very limited.
    So it may be that my samples are not easy to understand for you.
    Do you have any knowledge in Windows Forms or WPF or do you know only VFP?
    (in some of my WPF projects I'm using DBF data, so the GUI choice don't depends on the database choice).
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Beginners Example 25 Jan 2021 20:40 #17293

    • ulli25


  • Posts: 4
  • I did basic work with C# and visual studio. Developed some console application and worked with some YouTube
    learning programs also for WinForms and WPF. The database can also be ms sql. I will be able to change a program to work with vfpoledb instead of sql server. Is that enough? If you suggest some other program or sample for learning purpose I will work on that in my spare time.
    Ulli

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

    Beginners Example 26 Jan 2021 12:16 #17296

    • Terry


  • Posts: 262
  • Hi Ulli
    You are in the right place. There is plenty of expertise in these forums to help you, and contributors willing to help.
    There is, too, plenty to learn, as I’m sure you know. This means that you need to tackle the learning process in the most efficient and easiest way possible thus minimising time spent on learning stuff you do not or will not need in the future.
    XSharp is a language designed to drag the past into the future, using a syntax most are already familiar with from the days of VO. (I did use VO, but have largely forgotten it, went to C# but importantly for other reasons, so can’t talk XSharp code.)
    Therefore, unless you have an existing commercial product using VFP that you want to programmatically bring up to date, I would suggest you forget VFP and using your knowledge of what your original program did, concentrate on writing it directly in XSharp. That is likely to be the quicker route.
    Having said that, if you are principally thinking development of Business Applications, although there is much read-across to C#, IMO you don’t really need much C# code.
    Knowledge of WinForms and WFP will stand you in good stead.
    If, however, your objective is a broader understanding then C# coding is a must.
    The structures of .Net map very closely, almost identically, to real-world structures imposed by nature. That may be difficult to see, but it means future porting of your applications to accommodate new technologies (even though we don’t at the moment know what they will be) can be assured.
    Terry

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

    Beginners Example 27 Jan 2021 05:51 #17311

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2836
  • Hi Ulli,
    I remembered that sometimes in the past I had written a sample to use a DBF in a Windows Forms Grid.
    Here it is:

    File Attachment:

    File Name: WinformDBF.zip
    File Size:4 KB

    A few notes:
    • please import the viaef file into your XIDE project
    • the sample makes use of a VO class, the DBServer, so therefore you need the VO runtime libraries
    • please look at the ProgSettings.prg: there are the settings where your DBF files are and what the RDD is
    • RDD: maybe I have to explain it a bit: RDD stands for Replaceable Database Driver and indicates what engine should be used to open the data files. In my sample it is DBFNTX as I'm using sample data from the VO standard installation. If you have FoxPro data, you should use DBFVFP
    • it is in the DataFactory where the DBF files are read and written into a standard .NET datatable for use in the Windows Forms DataGrid
    • the datagrid is read only, i.e. the data is not written back to the DBF table
    If you are interested, I can build the same for WPF.
    And, if I have some time, I have to finish my DBFServer class that used the RDD directly and is maybe better suited to access DBF data for people that has no VO background.
    Wolfgang
    P.S. of course, feel free to ask! We are here to help you get started.
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it
    Attachments:

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

    Beginners Example 06 Jul 2021 23:42 #19013

    • OhioJoe
    • OhioJoe's Avatar


  • Posts: 104
  • Wolfgang, do you ( or does anyone else) have a WPF example of your WinformDBF example?
    The attachment shows how it looks when I run it locally and when I run it on a Remote Desktop server. High-resolution monitors don't like pixel-based Winforms and VO GUI renderings. I understand that "vector-based" WPF can fix this but I'd rather not go down that road without hearing from you fellows first.
    Joe Curran
    Ohio USA
    Attachments:

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

    Beginners Example 07 Jul 2021 05:46 #19016

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2836
  • Hi Joe,
    I will do that, of course.
    WPF is even easier to do (for me) as most of my pure X# programming is done in WPF (and XIDE).
    My WPF windows are all done in pure code, and that helps me be more flexible.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Beginners Example 07 Jul 2021 08:32 #19018

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2836
  • Hi Joe,
    here it is:

    File Attachment:

    File Name: WPFDBF.zip
    File Size:3 KB

    It seems even easier than the Windows Forms example.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it
    Attachments:

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

    Beginners Example 07 Jul 2021 09:32 #19022

    • FFF


  • Posts: 1241
  • Very nice, Wolfgang.
    Me being a WPF-noob - is there an easy way to change the font used in the datagrid?
    Regards
    Karl (X# 2.7; Xide 1.27; W8.1/64 German)

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

    Beginners Example 07 Jul 2021 09:40 #19023

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2836
  • Hi Karl,
    really hard <g>:
    _oDataGrid:FontFamily	:= FontFamily{ "Courier New" }
    _oDataGrid:FontSize		:= 20
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Beginners Example 07 Jul 2021 10:25 #19024

    • FFF


  • Posts: 1241
  • Blush...
    (But, by way of excuse, i had looked in the api browser, there's no entry regarding font in DataGrid's properties...)

    While blushing ;-) , Datagrid has a backround property, but that's only the little rectangles fencing the scrollbar.
    Probably, i need oDataGrid:CellStyle := Style{ } ? But i don't get, what/which "type" the style constructor wants...
    THX!
    Regards
    Karl (X# 2.7; Xide 1.27; W8.1/64 German)

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

    Beginners Example 07 Jul 2021 10:32 #19025

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2836
  • Hi Karl,
    unfortunately it is not that easy. This is code from my own class library:
    oHeaderStyle := Style{ TypeOf( System.Windows.Controls.Primitives.DataGridColumnHeader ) }
    oHeaderStyle:Setters:Add( Setter{ System.Windows.Controls.Primitives.DataGridColumnHeader.BackgroundProperty, MVVMControlSettings.DataGridHeaderBackground } )
    oHeaderStyle:Setters:Add( Setter{ System.Windows.Controls.Primitives.DataGridColumnHeader.SeparatorVisibilityProperty, Visibility.Visible } )
    oHeaderStyle:Setters:Add( Setter{ System.Windows.Controls.Primitives.DataGridColumnHeader.SeparatorBrushProperty, MVVMControlSettings.DataGridVerticalGridLinesBrush } )
    oHeaderStyle:Setters:Add( Setter{ System.Windows.Controls.Primitives.DataGridColumnHeader.PaddingProperty, MVVMControlSettings.DataGridHeaderPadding } )
    self:ColumnHeaderStyle := oHeaderStyle
    oCellStyle := Style{ TypeOf( System.Windows.Controls.DataGridCell ) }
    oCellStyle:Setters:Add( Setter{ System.Windows.Controls.DataGridCell.PaddingProperty, MVVMControlSettings.DataGridCellPadding } )
    self:CellStyle := oCellStyle
    Sometimes it is hard to work without XAML.....
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Beginners Example 07 Jul 2021 10:54 #19026

    • FFF


  • Posts: 1241
  • Argh...
    I think i sort of understand this, so to play further, could you solve "MVVMControlSettings"? Probably a Using missing, but as the apibrowser knows nothing about this term, so what to add?
    Regards
    Karl (X# 2.7; Xide 1.27; W8.1/64 German)

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

    Beginners Example 07 Jul 2021 11:03 #19027

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2836
  • Hi Karl,
    that is my static settings class - I have copied this code from there.
    MVVMControlSettings.DataGridHeaderPadding := System.Windows.Thickness{ 5, 5, 5, 5 }
    MVVMControlSettings.DataGridCellPadding := System.Windows.Thickness{ 6, 6, 6, 6 }  // geht aktuell nicht
    MVVMControlSettings.DataGridAlternatingRowBackground := System.Windows.Media.SolidColorBrush{ System.Windows.Media.Colors.Gainsboro }
    MVVMControlSettings.DataGridVerticalGridLinesBrush := System.Windows.Media.SolidColorBrush{ System.Windows.Media.Color.FromRgb( 170,170,170 ) }
    MVVMControlSettings.DataGridHeaderBackground := System.Windows.Media.SolidColorBrush{ System.Windows.Media.Color.FromRgb( 238, 238, 238 ) }
    MVVMControlSettings.DataGridRowHeight := 20

    These are the defaults for all my applications, but are settable on an application level.
    Normally, you use stylesheets for this - that is easier.
    But since I don't select always the easiest way, but the way that seems me more flexible, sometimes I have to do strange things.

    But nevertheless, for some styles I do add a XAML stylesheet as resource into my WPF applications.

    Maybe I should publish a full featured WPF application as sample.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it
    Attachments:

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

    Beginners Example 07 Jul 2021 11:20 #19029

    • FFF


  • Posts: 1241
  • Hi Wolfgang,
    thx very much, now it works.
    Maybe I should publish a full featured WPF application as sample
    That surely would be helpfull - best including access to PG ;-)
    Regards
    Karl (X# 2.7; Xide 1.27; W8.1/64 German)

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

    Beginners Example 07 Jul 2021 11:39 #19031

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2836
  • Hi Karl,
    PostgreSQL access is standard in my newer applications whenever I have the choice:

    The main problem is that I have several different libraries in my framework, for different GUI choices (WPF, Windows Forms, Console) and for different database backends (DBF, ADS, Oracle, MS SQL Server, MySQL, PostgreSQL, SQLite), and therefore I have to combine a lot of code into the same application/lib to not to have to share my entire framework.
    What you see is one WPF application with only PostgreSQL access, but I have also applications that are accessing 3 or 4 different database backends.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it
    Attachments:

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