Results 1 to 36 of 36

Thread: Help me decide which Control [RESOLVED]

  1. #1

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Help me decide which Control [RESOLVED]

    I have a list of blocks and have 12 sizes with 12 prices for each block, so I built an array (10,12,12). Now I want the user to be able to edit the information to change prices and/or quantities.
    Do I want to use a Flexgrid? If so, how do I load it into my project? I'm kind of stumped right now.
    I want to load headings, and then load the data, and have the user edit, which then saves the new data.
    I am using a text file, and have the code finished. My program uses the names from this text file, and loads them into a listbox.
    Last edited by dglienna; Sep 8th, 2004 at 03:26 PM.

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    Not sure I understand what the 10 is in the first array spot...

    But why not use FLEXGRIDS - you can have 10 of them (hide them behind each other). Use radio buttons to make each one show (still don't know why you have 10 - what that means)...

    FLEXGRIDS cannot actually be editted, but it's pretty easy to float a TEXTBOX onto the CELL that is clicked and let the user do entry into it...

    Just a suggestion...

  3. #3

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    That sounds like exactly what I want. The question is HOW?

    10 different block names, with 12 different sizes. Each has a cost and quantity associated with it.

    I don't know how to get a flexgrid onto my form!

    I want to have cost over quantity, in two rows for each name.

    The first time I did it, I used text labels, but its user interface left something to be desired!

  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    Add a component to the project...

    Under my VB it's called "MICROSOFT FLEXGRID 6.0 (SP3)".

    That puts the flexgrid onto the object/control tab...

    It's a very nice control - but very complex it can be...

    I've seen lots of postings on this forum about it, so I'm sure you can find out just about anything.

    We use this exclusively to edit data in our SQL databases.

    Good luck

  5. #5

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    is it under Add-Ins?

  6. #6
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    Under PROJECT>COMPONENTS - first tab - CONTROLS.

  7. #7

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    I found it. I was searching all day in the wrong place.
    I will now look how to use it.
    Thanks.

  8. #8

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    I have a new form, do I just do everything in the form load event?
    I think that I have the syntax in my Components book.
    Is there a sample in Codebank that uses this?

    Is there a difference between MSFlexgrid and MSHFlexgrid?

    The book doesn't have any AddItem for MSFlexgrid, only the Hierarchical one, which leaves me a bit confused.

    I am looking forward to mastering this one...

    right now, struggling with where to place sample code.

    time out for food!
    Last edited by dglienna; Sep 3rd, 2004 at 05:32 PM.

  9. #9

  10. #10
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    Originally posted by MartinLiss
    Actually they can be.
    I've seen your code for this before - but it's not like we have TEXTBOX access to a cell with it.

    I prefer the "move" a textbox or combobox onto the cell and make believe like you are really in the cell concept. It looks real and feels real...

    Just my opinion...

  11. #11

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    Do you have an example?

  12. #12
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    I'll be in work tomorrow (Saturday - but does that ever matter??)

    I'll try to give you some sample code then - sorry for the delay...

  13. #13

  14. #14

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    thanks. i was looking for an example of loading an array into the grid, and then editing values before re-saving them for the rest of the program to use.

  15. #15
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    Not sure how far you have gotten, or the route you are taking...

    The flex grid exposes a "string array" that represents each cell.

    .TEXTMATRIX(.ROW,.COL) is the property.

    You can both set and retrieve values from this array.

    This is the "grid cells" that are displayed to the user.

    There are add methods - you can add new rows by building a string, each "column" of data separated by a TAB characters, and add that row instantly like that.

    Or increase the .ROWS value by one and fill the new row manually (using .TEXTMATRIX(r,c) array)

    You can have .FIXEDROWS and .FIXEDCOLS for heading or "left side" fixed rows and columns.

    And you can refer to the GRID in all forms in you project, by simply using FORM1.FLEXGRID1.TEXTMATRIX(R,C).

  16. #16

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    szlammy - how about the floating textbox example?

  17. #17

  18. #18

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    Thanks. If I format the items as currency, will it cause problems to edit it this way, and to place the items back into the array?
    I was going to copy them all after editing all of them, but now I am thinking that I can write each one as I edit it.
    I just wonder if I should format each one to two decimal places so that it looks right.

    i tried textmatrix(1,1)=format(somevalue , #.##)
    but it doesn't work. any ideas why?
    Last edited by dglienna; Sep 5th, 2004 at 04:11 PM.

  19. #19

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    I have 210 items in my flexgrid. Now to go about editing them.
    I've decided to write the info back at form unload so that the other module gets the new information.
    It woud look better formatted, but it *really* isn't necessary.
    It shows 4 dollars as 4 and 3.30 as 3.3. Irritating, but liveable.
    Comma seperators would be nice for 2333 also.

  20. #20
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Originally posted by dglienna
    Thanks. If I format the items as currency, will it cause problems to edit it this way, and to place the items back into the array?
    I was going to copy them all after editing all of them, but now I am thinking that I can write each one as I edit it.
    I just wonder if I should format each one to two decimal places so that it looks right.

    i tried textmatrix(1,1)=format(somevalue , #.##)
    but it doesn't work. any ideas why?
    textmatrix(1,1)=format(somevalue , "#.##")

  21. #21
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    Originally posted by dglienna
    Comma seperators would be nice for 2333 also.
    We have our own home-grown "dollar formatting functions" - actually we prefer to do all our validation and formatting in a single function. It translates from STORED to INPUT to DISPLAY format - based on parameters you set. We use this function throughout all out code for solid-consistency.

    If we pass it a US phone number, it verifies that it's 7 or 10 digits and numeric - then if the output format is "DISPLAY" then we put the "()-" edit mask into it.

    We only use comma-separators for reports - they are hard to deal with in updates to a database, as they are "invalid" numeric characters.

  22. #22

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    "#.##")

    thanks. missed the quotes somehow.

    szlammy - care to share one of them? i can imagine a few ways to do this, but want the best/easiest.

    ps - it worked great, but I changed it to #0.00 so that there is always something there, and #,##0 for the quantity.
    I couldn't manage to center the row headings, but used "* Qty" which seems to be working.
    Last edited by dglienna; Sep 6th, 2004 at 01:40 AM.

  23. #23
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    When you have a column you want centered, when you're building the headings with the .FORMATSTRING property, put a "^" character as the first character of the heading for that column.

    Not at work today - so I can't give you a function for formatting...

  24. #24

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    sorry, i meant the ROW couldn't be centered. Did it for the COLS, though. That's why I was asking.
    ROW appears as "^Qty" when I use "|^Qte"

  25. #25

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    still nothing new. can't center ROW info, and waiting for floating flexgrid textbox. anyone?

  26. #26
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    Sorry for not getting back to you earlier...

    We just installed a large school district in CT here and it's been a wild two weeks...

    Here is some code for placing a TEXT BOX onto a CELL.

    VB Code:
    1. f.txtInput.Appearance = 0
    2.     f.txtInput.Tag = Str$(lngFII)
    3.     f.txtInput.Move f.flxInput(y).CellLeft + f.flxInput(y).Left _
    4.             , f.flxInput(y).CellTop + f.flxInput(y).Top _
    5.             , f.flxInput(y).CellWidth _
    6.             , f.flxInput(y).CellHeight
    7.     f.txtInput.Visible = True
    8.     f.txtInput.Enabled = True
    9.     f.txtInput.ZOrder 0
    10.     f.txtInput.MaxLength = f.flxInput(y).ColData(f.flxInput(y).Col)
    11.    
    12.     f.txtInput.Text = f.flxInput(y).TextMatrix(f.flxInput(y).Row, f.flxInput(y).Col)
    13.    
    14.     f.txtInput.ToolTipText = "Current Entry Field for the Grid"
    15.         '(" & CStr(f.flxInput(y).Row) & "," & CStr(f.flxInput(y).Col) & ")"

  27. #27

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    thanks. I'll try to implement that later.
    I am filling up the form, and would like to be able to edit a cell, and have the same number input into other cells. This way, a user could input a new price, and not have to re-enter it for successive prices (that are the same)
    I was going to print the current price, and the last thing typed for the new price. I see this as a way to do it.

  28. #28

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    szlammy - i can't inplement this. what is f.flxinput? I tried using flxinput as the name of my grid, except that I get the wrong number of arguments when trying to move with flxinput(y)
    I have a textbox named txtinput and changed my sub to support the new name.

  29. #29
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    f is my form (passed as an argument to a SUB in the BASMAIN) and flxinput(y) is the flexgrid. It got a (y) trailing it because it's a control array of many flex grids on a form.

    Just change "f.flxinput(y)" to whatever your grid is called.

  30. #30

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    and this code goes in the mouseup event?

  31. #31
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    My app is very complex - I actually have a "FocusPilot" function that drives the focus around the form.

    I would think that MOUSEUP would work...

  32. #32

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    Code:
    Private Sub flxinput_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
        txtInput.Appearance = 0
        txtInput.Tag = Str$(lngFII)
        txtInput.Move flxinput.CellLeft + flxinput.Left _
                , flxinput.CellTop + flxinput.Top _
                , flxinput.CellWidth _
                , flxinput.CellHeight
        txtInput.Visible = True
        txtInput.Enabled = True
        txtInput.ZOrder 0
        txtInput.MaxLength = flxinput.ColData(flxinput.Col) '
        txtInput.Text = flxinput.TextMatrix(flxinput.Row, flxinput.Col)
    
    '    txtInput.ToolTipText = "Current Entry Field For the Grid"
    '        '(" & CStr(f.flxInput(y).Row) & "," & CStr(f.flxInput(y).Col) & ")"
    End Sub
    OK, when I click on a cell, the textbox doesn't show, and it doesn't allow editing. the textbox disappears from the top of the form, though, so I know that something is working. Its just not the way that I want it. the selected cell is highlighted, though.

  33. #33
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    Throw in some DEBUG.PRINT statements about the position of the textbox - make sure it's going where it is supposed to...

  34. #34

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    i moved it down 50, and saw that the old cell is covered by the textbox, but it doesn't allow editing. if i change the value it goes right back to the old value. i'd like it to wait for the enter key, or else to tab out of the field.
    Last edited by dglienna; Sep 8th, 2004 at 03:01 PM.

  35. #35
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    The idea is that you are covering the CELL with the textbox - which is exactly the same size. Then set the focus to the textbox - where the editing of the TEXTBOX looks like you are editing the cell.

    Then on the key events of the textbox, you hide the TEXTBOX and put the contents of it back in the cell.

  36. #36

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    OK. I got it to work. Thankx for your help. I'll close this thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width