It is currently Mon Jan 20, 2020 9:51 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 87 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Mar 21, 2013 9:32 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Dec 23, 2009 3:26 pm
Posts: 171
well done!
PS:the demo window flickers when resize it , :(,SmartWindowRefresh doesn't work, Win7 32bit PB5.11

_________________
poor English...

PureBasic & Delphi & VBA


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Mar 21, 2013 1:43 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Sep 11, 2004 11:54 am
Posts: 532
Location: UK
An excellent job, well done Said!

I offer the following comments with the caveats (a) after a short test it is so easy to overlook the obvious and (b) the “it is different so it's wrong” syndrome applies to most people, but me in particular :oops:

- ComboBox() Cell - Yes please.
- Option for a single click to activate cell/s would be good. (I use this option with Srod's grid and prefer it.)
- I prefer not to press Return to leave text in a cell. (Option switch?)
- How do you recover a row that was accidentally shrunk to zero height?
- Numbers only/Letters only option for individual cells / rows / columns. 'Numbers only' to optionally allow a decimal point? Format mask ####.## would be superb!
- Could MyGrid_SetText() use the Pure Basic standard parameter order (Gadget#, X,Y,Text)
- The popup menu is not associated with the grid / cursor. I'm using multiple monitors and the grid can be on one and the popup can appear on the other.

Regards,
RichardL


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Mar 21, 2013 10:10 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 342
leonhardt wrote:
well done!
PS:the demo window flickers when resize it , :(,SmartWindowRefresh doesn't work, Win7 32bit PB5.11


Thanks, as for flicking honestly i have no clue how to fix this! It is not happening here Win7 x64?!


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Mar 21, 2013 10:34 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 342
RichardL wrote:
An excellent job, well done Said!

I offer the following comments with the caveats (a) after a short test it is so easy to overlook the obvious and (b) the “it is different so it's wrong” syndrome applies to most people, but me in particular :oops:

- ComboBox() Cell - Yes please.
- Option for a single click to activate cell/s would be good. (I use this option with Srod's grid and prefer it.)
- I prefer not to press Return to leave text in a cell. (Option switch?)
- How do you recover a row that was accidentally shrunk to zero height?
- Numbers only/Letters only option for individual cells / rows / columns. 'Numbers only' to optionally allow a decimal point? Format mask ####.## would be superb!
- Could MyGrid_SetText() use the Pure Basic standard parameter order (Gadget#, X,Y,Text)
- The popup menu is not associated with the grid / cursor. I'm using multiple monitors and the grid can be on one and the popup can appear on the other.

Regards,
RichardL


Thanks! appreciate your offered comments and i guess am affected by that syndrome as well :mrgreen:

Overall, for updates/revisions and new stuffs, i will try my best to implement as soon as i can (i have my daily work to finish as well :( ) ... Building a descent pro grid 'a la Excel' is a huge work. My code is open source and you (and others) are most welcome to have your say and customize it to suit your needs ...

- When you say 'activate cell' do you mean open it for editing? right now it is in 'overwrite' mode, if you press enter or double-click you go in insert mode
- Cell data type (number/decimals/dates/... with masks) will come later inshAllah
- That multiple monitors issue is new to me! I will try to figure out what is going on :shock:

- if a column/row is hidden (accidentally or on purpose) cannot be shown again via resizing, this is done on purpose! Right now un-hiding should be managed by the caller application that can offer to un-hide thru popup menus or other means. I admit this is not the common and expected behavior but these were the guidelines! I shall implement the normal way!

Regards,
Said


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Mar 21, 2013 10:41 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 342
mevedia.de wrote:
Nice :wink: , there's just a small Bug if you collapse a Column (can't size it anymore). I could recommend you the Scroll Control. :D Directly connect your Canvas and a Pointer to x/y Coordinates.


Thanks, personally am not comfortable with using userlibs ( i have the feelings they are a great source of un-managed errors :!: )

As for the described bug, actually this is done on purpose - this is not a common behavior but yes it was done on purpose! By the way, your work looks very appealing but being as userlib format is keeping me (and other i guess) from using it


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Mar 21, 2013 11:02 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3171
Location: Boston, MA
said wrote:
RichardL wrote:
- The popup menu is not associated with the grid / cursor. I'm using multiple monitors and the grid can be on one and the popup can appear on the other.

Regards,
RichardL
- That multiple monitors issue is new to me! I will try to figure out what is going on :shock:
Regards,
Said

I use multiple monitors also and this quick fix worked fine. :wink:
Code:
      If _MyGrid_OverCellArea(*mg, x, y)
        ;DisplayPopupMenu(*mg\AttachedPopupMenu, WindowID(*mg\Window), x, y)
        DisplayPopupMenu(*mg\AttachedPopupMenu, WindowID(*mg\Window));, x, y)
      EndIf

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Fri Mar 22, 2013 5:34 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 342
skywalk wrote:
I use multiple monitors also and this quick fix worked fine. :wink:
Code:
      If _MyGrid_OverCellArea(*mg, x, y)
        ;DisplayPopupMenu(*mg\AttachedPopupMenu, WindowID(*mg\Window), x, y)
        DisplayPopupMenu(*mg\AttachedPopupMenu, WindowID(*mg\Window));, x, y)
      EndIf


Interesting :!: thanks for the tip, i hope it solves the issue for RichardL (i dont have access to multi-monitors right now, i use only laptops)

@mevedia.de: i know maybe a new variant of XIncludeFile that works with encrypted source code would be an option :?: We need the help of the master here ... FRED


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Fri Mar 22, 2013 9:08 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4600
Location: Lyon - France
Great !!!
Thanks for sharing 8)

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Sun Mar 24, 2013 11:01 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 342
Just revised the code to allow un-hiding a row/col that was re-sized to 0 via mouse ... Now it works as one expects :D

See first 2 posts

Said


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Sun Mar 24, 2013 2:31 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1726
Location: Uttoxeter, UK
Has that professional look!

Very nice, thanks for sharing. :D

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Wed Mar 27, 2013 12:39 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2149
Location: Germany
Cool, I'm VERY excited. Thank´s to shared.

[Edit]
I´m added 'F2' for starting edit
Changed in MyGrid_ManageEvent
Code:
...
Case #PB_Shortcut_Return, #PB_Shortcut_F2
...

:D

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Wed Mar 27, 2013 5:43 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 342
mk-soft wrote:
Cool, I'm VERY excited. Thank´s to shared.

[Edit]
I´m added 'F2' for starting edit
Changed in MyGrid_ManageEvent
Code:
...
Case #PB_Shortcut_Return, #PB_Shortcut_F2
...

:D


Nice tip :!: like in Excel


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Mar 28, 2013 12:28 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2149
Location: Germany
My Idee for Copy and Paste
Code:
...

Enumeration 1024 ; <- Check valid MenuItemID
  #MyGrid_MenuEvent_Ctrl_C
  #MyGrid_MenuEvent_Ctrl_V
  #MyGrid_MenuEvent_Ctrl_X
EndEnumeration

Procedure.i MyGrid_ManageMenuEvent(Gdt.i, eType)
   Protected *mg._MyGrid_Type = GetGadgetData(Gdt)
   
    If GetActiveGadget() <> gdt
      ProcedureReturn
    EndIf
   
    Select eType
       
      Case #MyGrid_MenuEvent_Ctrl_C
       
        If MyGrid_ShowCell(gdt, *mg\Row, *mg\Col)
          SetClipboardText(MyGrid_GetText(gdt, *mg\Row, *mg\Col))
        EndIf
         
        Case #MyGrid_MenuEvent_Ctrl_V
          If MyGrid_ShowCell(gdt, *mg\Row, *mg\Col)
            MyGrid_SetText(gdt, *mg\Row, *mg\Col, GetClipboardText())
            MyGrid_Redraw(gdt)
          EndIf
         
        Case #MyGrid_MenuEvent_Ctrl_X
          If MyGrid_ShowCell(gdt, *mg\Row, *mg\Col)
            SetClipboardText(MyGrid_GetText(gdt, *mg\Row, *mg\Col))
            MyGrid_SetText(gdt, *mg\Row, *mg\Col, "")
            MyGrid_Redraw(gdt)
          EndIf
         
    EndSelect
       
EndProcedure   
       
;-{ Test
CompilerIf #PB_Compiler_IsMainFile
   
Enumeration
   #Win_Nbr
   #Grid_Nbr
   #Grid_ColScroll
   #Grid_RowScroll
   #Grid_PopupMenu
   #MenuItem_1
   #MenuItem_2
   #MenuItem_3
   #MenuItem_4
   #MenuItem_5
EndEnumeration

Global ii, iii, EvGd, Evnt, EvTp, EvMn

If OpenWindow(#Win_Nbr, 0, 0, 1000, 670, "MyGrid Said", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered|#PB_Window_SizeGadget)
   SetWindowColor(#Win_Nbr,#White)
   
   If CreatePopupMenu(#Grid_PopupMenu)      ; creation of the pop-up menu begins...
      MenuItem(#MenuItem_1, "Show")
      MenuItem(#MenuItem_2, "Hide")
      MenuItem(#MenuItem_3, "Freeze here")
      MenuBar()
      OpenSubMenu("Sub-menu")
         MenuItem(#MenuItem_4, "sub 1")
         MenuItem(#MenuItem_5, "sub 2")
      CloseSubMenu()
   EndIf
   
    MyGrid_New(#Win_Nbr, 0, #Grid_Nbr, #Grid_ColScroll, #Grid_RowScroll,10, 10, 920, 650,20000,100, #True)
   
   
    ; customize the grid ...
    MyGrid_AttachPopup(#Grid_Nbr, #Grid_PopupMenu)
    MyGrid_NoRedraw(#Grid_Nbr)
       
        MyGrid_Col_Freeze(#Grid_Nbr, 3)
        MyGrid_Row_Freeze(#Grid_Nbr, 5)
       
        ; example of extra style ( checkboxes at col# 9)
        ii = _MyGrid_AddExtraStyle(GetGadgetData(#Grid_Nbr), #MyGrid_Align_Center, $E6D8AD,#Blue,Font_A8,#MyGrid_CellType_Checkbox,#True)
        _MyGrid_SetExtraStyle(GetGadgetData(#Grid_Nbr), #MyGrid_RC_Data, 9, ii)
             
        ;MyGrid_Col_Hide(#Grid_Nbr, 0, 1)
        ;MyGrid_Row_Hide(#Grid_Nbr, 0, 1)
        MyGrid_Col_Hide(#Grid_Nbr, 7, 1)
        ; Add ShortCut
        AddKeyboardShortcut(#Win_Nbr, #PB_Shortcut_Control | #PB_Shortcut_C, #MyGrid_MenuEvent_Ctrl_C)
        AddKeyboardShortcut(#Win_Nbr, #PB_Shortcut_Control | #PB_Shortcut_V, #MyGrid_MenuEvent_Ctrl_V)
        AddKeyboardShortcut(#Win_Nbr, #PB_Shortcut_Control | #PB_Shortcut_X, #MyGrid_MenuEvent_Ctrl_X)
       

    MyGrid_Redraw(#Grid_Nbr)
   
    Repeat
        EvGd = -1
        EvTp = -1
        EvMn = -1
        Evnt = WaitWindowEvent()
        Select Evnt
            Case #PB_Event_SizeWindow
                MyGrid_Resize(#Grid_Nbr, #PB_Ignore, #PB_Ignore, WindowWidth(#Win_Nbr) - 80, WindowHeight(#Win_Nbr) - 20)
               
            Case #PB_Event_Gadget
                EvGd = EventGadget()
                EvTp = EventType()
                Select EvGd
                    Case #Grid_Nbr
                        MyGrid_ManageEvent(EvGd, EvTp, 0)
                    Case #Grid_ColScroll
                        MyGrid_ManageEvent(#Grid_Nbr, EvTp, #Grid_ColScroll)
                    Case #Grid_RowScroll
                        MyGrid_ManageEvent(#Grid_Nbr, EvTp, #Grid_RowScroll)
                EndSelect
           
         Case #PB_Event_Menu
            EvMn = EventMenu()
            MyGrid_ManageMenuEvent(#Grid_Nbr, EvMn)
            Select EvMn
               Case #MenuItem_1 : Debug " popup menu 1 "
               Case #MenuItem_2 : Debug " popup menu 2 "
               Case #MenuItem_3 : Debug " popup menu 3 "
               Case #MenuItem_4 : Debug " popup menu 4 "
               Case #MenuItem_5 : Debug " popup menu 5 "
            EndSelect
           
      EndSelect
       
       
    Until  Evnt = #PB_Event_CloseWindow
EndIf
CompilerEndIf
;}


:wink:

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Mar 28, 2013 6:08 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 342
mk-soft, you are faster than me in adding new stuff/improving :!: I shall resume work on it this weekend, and planning to add:
1. Cell span (merging cells in cols/rows)
2. Block management
3. Combo-box cell type

As for your additions i have the following remarks ...

1. I like your idea for Copy/Paste and MyGrid_ManageMenuEvent() fits well in the code and very much in line with what i have in mind (i might use it as is if you dont mind)
2. Pasting/Cutting( Ctrl V/X) should be done in editable cells only - we need to add a little test here
3. This works only so far with a single cell - the common way is to use it for a block of cells (i shall add that block asap now :? )
4. Since we are crossplatform, we need to make sure that the AddKeyboardShortcut are properly added for each OS (personally i have no idea what shall we use for OSX/Linux, is it the same, am stuck with windows only)
AddKeyboardShortcut(#Win_Nbr, #PB_Shortcut_Control | #PB_Shortcut_C, #MyGrid_MenuEvent_Ctrl_C)
AddKeyboardShortcut(#Win_Nbr, #PB_Shortcut_Control | #PB_Shortcut_V, #MyGrid_MenuEvent_Ctrl_V)
AddKeyboardShortcut(#Win_Nbr, #PB_Shortcut_Control | #PB_Shortcut_X, #MyGrid_MenuEvent_Ctrl_X)

And last thanks for improving :D


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Fri Mar 29, 2013 9:57 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Sep 11, 2004 11:54 am
Posts: 532
Location: UK
Good morning,

Some random thoughts...

- I use SRod's grid a lot and one of the useful features is an option for a cell to become editable after a single click (not a double click, or F2 as in a spreadsheet.) Mostly this is an option chosen on a column basis.

- When designing a grid to be used as a data entry mechanism it is a good idea to imagine yourself as a super fast typist** who would much rather enter a new line of data without taking a hand away from the keyboard to use the mouse.

- Using F2 to start an edit allows the cursor left/right keys to be used to navigate the edit box around the grid and then to move the caret left/right in a cell to choose an edit point in pre-existing text.

I wish you a happy and productive weekend.... :D

RichardL

** Off topic: I have an aunt who trained as a touch typist in pre-computer days. She could put a paper bag over her head so she could not see the keyboard, then sing a song while typing it!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 87 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye