Grid with multilines? Is it possible?

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Grid with multilines? Is it possible?

Post by AUGE_OHR »

hi,

i have see TSbrowse() and know native Listview using Ownerdraw / CustomDraw.
but for Calendar i prefer a "fix Grid".
a Day have only 24 hour so ROW or COL are "fixed" and "no browse" are need "to scroll"

i use Time as ROW as Outlook Calendar does it.
also DBF Sturcture is made for MAPI so i can "sync" Calendar Data "on-fly"

the Problem was to "simulate" a Grid so when DragDrop LABEL it will "snap to Grid" to get right ROW / COL.
as you see i can change Display to show 1 / 5 / 7 or 14 Days. i take much more Time to Add/Del Column in Browse.
so i "think" a "fixed Grid" is better for Calendar.
have fun
Jimmy
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Grid with multilines? Is it possible?

Post by franco »

I do not know if this will work for you, but what I did was.
The field description in my table was 25 characters. So I added a field longdesc, C,80,0
It is a textbox out outside at the bottom of the grid. What my clients use it for is if 25 characters are not enough. It gets refreshed and saved
the same a the fields in the grid. If there is something in the longdesc, when printing it prints on the line after the grid fields and before next
grid Line. I don`t know how much you want to add but 2 of these fields could hold a lot of information.
I use this on a sales invoice. The line would be 1 line above your sub total line on your invoice.
All The Best,
Franco
Canada
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Grid with multilines? Is it possible?

Post by AUGE_OHR »

hi,

in a GRID each CELL have same height.
you can "init" GRID with big Font an change after create to normal Font to get "more Space" for "multi-line" Text.

---

using Ownerdraw , with LVS_OWNERDRAWFIXED, you get WM_MEASUREITEM and WM_DRAWITEM Message

Code: Select all

      CASE nMsg == WM_MEASUREITEM
         ::My_MEASUREITEM(wp,lp)
         RETURN 1

      CASE nMsg == WM_DRAWITEM
         ::My_DRAWITEM(wp,lp)
         RETURN 1
using MEASUREITEMSTRUCT() you can "manipulate" Size of Cell
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Code: Select all

INLINE METHOD My_MEASUREITEM(wp,lp)

   cCaption    := ::lv_GetItemText(::oMeasureitemstruct:itemID+1) // zero-based
   aTextSize   := ::GetTextExtentPoint(cCaption)

   ::aDims := { ::oMeasureitemstruct:itemWidth ,;
                ::oMeasureitemstruct:itemHeight  }

   nWidth      := MAX(::aDims[1],aTextSize[1])
   nHeight     := MAX(::aDims[2],aTextSize[2])

   ::oMeasureitemstruct:itemWidth  := nWidth
   ::oMeasureitemstruct:itemHeight := nHeight
using DRAWITEMSTRUCT() you get all Information to "paint"
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

but the "Problem" is : how can User use Callback Slot :?:

under Xbase++ i can use a Callback Slot with Codeblock

Code: Select all

   // if User have set Codeblock in o:drawItem Slot
   //
   IF VALTYPE( ::drawItem ) == "B"
      // first 4 same as Xbase++ aInfo Array
      //
      aInfo := { ::oDrawItemStruct:itemID+1     ,;  // XBP_DRAWINFO_ITEM zero-based
                 ::oDrawItemStruct:itemAction   ,;  // XBP_DRAWINFO_ACTION
                 ::oDrawItemStruct:itemState    ,;  // XBP_DRAWINFO_STATE
                {::oDrawItemStruct:rcItem:Left, ::oDrawItemStruct:rcItem:Top, ::oDrawItemStruct:rcItem:Right, ::oDrawItemStruct:rcItem:Bottom },;
                 NIL                            ,;  // XBP_DRAWINFO_AREA
                 ::nColCount                    ,;  // XBP_DRAWINFO_COLUMN
                 ::oDrawItemStruct:hDC          ,;  // XBP_DRAWINFO_HDC
                 ::oDrawItemStruct:hwndItem     }   // XBP_DRAWINFO_HWND

      EVAL(    ::drawItem, ::oPresspace , aInfo , Self)
::oPresspace is use by Xbase++ to "paint" , Windows API can use HDC of DRAWITEMSTRUCT

so it is possible but much more Work than using LABEL for Calendar.
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Grid with multilines? Is it possible?

Post by AUGE_OHR »

hi,
you can "init" GRID with big Font an change after create to normal Font to get "more Space" for "multi-line" Text
other Sample here
https://www.hmgforum.com/viewtopic.php?t=6335&p=61059

Image
have fun
Jimmy
Post Reply