Grid gadget (egrid ver 1.1) complete - update 1.1b.

Developed or developing a new product in PureBasic? Tell the world about it.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Is it possible automatical activate the cell for editing direct after moving to it? (After selection I have to click on it , before I can insert text.)
When you say, moving to it, do you mean by clicking the cell only or are you including tabbing into the cell, using cursor keys etc?

It is easy to implement.
I may look like a mule, but I'm not a complete ass.
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

I mean tabbing or using cursor keys. ( but I like to activate a cell by one click, too)
I insert text in the first column, go to the next and insert the next text and so on.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

But as soon as a cell is being edited, using the cursor key simply moves the caret within the cell -as it should do, so I wouldn't advise changing this.

However, try making the following adjustment:
  1. Open the "egrid_KernelFunctions.pb" source file.
  2. Navigate to the 'egrid_editproc' procedure and find this code

    Code: Select all

        case #WM_KEYUP
          if wParam = #VK_TAB
    ;Identify the underlying egrid,
            ForEach egridList() ;Process all the elements...
              If gadgetid(egridList()\stringid) = hWnd : Break : Endif
            Next
            *pointer = egridList() ;In case some other Windows event alters the linked list to point to another element.
            egrid_tabcell(*pointer)
    ;        sendmessage_(hWnd, #EM_SETSEL,len(getgadgettext(*pointer\stringid)),len(getgadgettext(*pointer\stringid)))
            activategadget(*pointer\id)
    Change to:

    Code: Select all

        case #WM_KEYUP
          if wParam = #VK_TAB
    ;Identify the underlying egrid,
            ForEach egridList() ;Process all the elements...
              If gadgetid(egridList()\stringid) = hWnd : Break : Endif
            Next
            *pointer = egridList() ;In case some other Windows event alters the linked list to point to another element.
            egrid_tabcell(*pointer)
            sendmessage_(hWnd, #EM_SETSEL,len(getgadgettext(*pointer\stringid)),len(getgadgettext(*pointer\stringid)))
            activategadget(*pointer\stringid)
Now, if you are editing a cell (not simply having selected the cell) and press the tab key, then the focus will move to the next cell and you can type straight into the newly selected cell.
I think the only other thing we might add is a similar behaviour with the return key.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Previus post introduces a slight bug!

I have uploaded a new version (click the link below) which alters the behaviour of the tab and enter keys whilst editing cells.

Thorsten1867: This should be along the lines of what you were requesting.

Regards.
I may look like a mule, but I'm not a complete ass.
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

I've tried it. It's works perfect. That's what I need!
Thanks!!!!!!!!!!!!!!!!!! :D

(You get a place of honour in the credits of my program (KvGS). :D )
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

What about a percentage of the takings? :lol:
I may look like a mule, but I'm not a complete ass.
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

srod wrote:What about a percentage of the takings? :lol:
Oh, a percentage of nothing?! :lol:
The program will be freeware or perhaps donationware.
I'm sorry! :wink:
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Good luck with it. Please let me know when it's complete as I'd be interested to see an egrid being used in a proper app.

Regards.
I may look like a mule, but I'm not a complete ass.
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

You can work with it already, but I integrate regular new functions.
I can send it to you, but it's german (for german elementary schools).
Post Reply