Page 1 of 1

Xbrowse : Setup configuration file

PostPosted: Thu Apr 15, 2021 3:20 pm
by Marc Venken
Xbrowse has become so powerfull that we can build programs with less code then ever before. In all my programs xbrowse is the engine and fine tuning the Xbrowse is often a task of looking into samples for witch
tool/option/flag can be set.

Maybe a idea to have a setup button on every browse that we can call to configure the browse in runtime. Mr. Uwe has done this many times, but if it can be build into the FW source, it is available for all of us.
Not all can be setup i think, but mr. Rao is very good.... You never know ) It can also be a process of enhancement in every update.

Just a idea

Re: Xbrowse : Setup configuration file

PostPosted: Thu Apr 15, 2021 4:49 pm
by ukoenig
Marc,

yes a good idea.
Most of it I have done already
NEW a textcolor-selector added using the colorpicker from the border-colors.

Image

Image

the test



regards
Uwe :D

Re: Xbrowse : Setup configuration file

PostPosted: Thu Apr 15, 2021 9:44 pm
by Marc Venken
Uwe,

I know that you have done this before (forum sample reader).

There you use a setup button that opens a dialog with some folders. (Dialog and Xbrowse) are the one for this topic.

But can this setup be activated for any xbrowse we define ? Save settings by name or so
Uwe, absolut with the best intension, but don't take it to far for general use. You have a colorfull mind when programming :wink: :wink:

Mr. Otto also uses a technique to define a Xbrowse setup from a 'Xbrowse data file'. It's more the general options to in/exclude. (VERY interesting)

the combination of the two could become a good setup system. Personel I would prefer a Xbrowse to hold the settings above a INI file.

Maybe Mr. Rao prefers to have a setup system as a standalone class that can be included if the programmer would like to use it.
It's up to us then to have a class/function to link in or Mr. Rao provides something that can be used as setup.

Re: Xbrowse : Setup configuration file

PostPosted: Sat Apr 17, 2021 12:11 am
by ShumingWang
1.
data osettingbmp
method helpmenu()
2.
METHOD New( oWnd ) CLASS TXBrowse
...
::hBmpRecSel := FwRArrow()

// add the lines
::osettingbmp:=TBitmap():Define( "config",,::oWnd)
::osettingbmp:ltransparent:=.t.



3.
METHOD Paint() CLASS TXBrowse
...
PalBmpDraw( ::hDC, (::nHeaderHeight - 3-if(::lgetbar,::nrowheight*2,0))*0.2, RECORDSELECTOR_WIDTH*0.2,;
::osettingbmp:hBitmap,;
::osettingbmp:hPalette,;
if(::lgetbar,::nHeaderHeight - 3-::nrowheight*2,::nheaderHeight/::nHeaderLines)*0.8,;
if(::lgetbar,::nHeaderHeight - 3-::nrowheight*2,::nheaderHeight/::nHeaderLines)*0.8;
,, .t., Eval( ::bClrHeader, Self ) [ 2 ] )

end
// add lines end

::DispEnd( aInfo )
::oFont:Deactivate( hDC )
return 0

4.
METHOD LButtonDown( nRow, nCol, nFlags ) CLASS TXBrowse
...
if ::lDrag
return Super:LButtonDown( nRow, nCol, nFlags )
endif

// add the lines
if nRow < ::HeaderHeight()-if(::lgetbar,::nrowheight*2,0) .and. nCol > 0 .and.ncol<RECORDSELECTOR_WIDTH
::setmenu()
return
end

5.
METHOD helpmenu( nRow, nCol, nFlags ) CLASS TXBrowse

local oMenu, oCol
local cPrompt
local nFor, nLen
local omenu2
local color1,color2

nLen := len( ::aCols )

MENU omenu2 2007 popup
if ::nMarqueeStyle == MARQSTYLE_HIGHLROWMS
MENUITEM "选择行,取消选择行 Contrl+点击" ACTION (::SELECT(2),::drawline(.t.))
MENUITEM "选择块 Shift+点击" ACTION ::SELECT(3)
MENUITEM "选择全部 " ACTION ::SELECT(4)
MENUITEM "取消全部选择 " ACTION ::SELECT(0)
end
if ::nMarqueeStyle == MARQSTYLE_HIGHLROW
MENUITEM "双击鼠标,本行拖入单据主表" ACTION EVAL(::BLDBLClick) WHEN !EVAL(::beof())

end
if ::bkeydown<>nil.and.::nMarqueeStyle==MARQSTYLE_HIGHLCELL
MENUITEM "添加新行 Insert" ACTION EVAL(::bkeydown,VK_INSERT) WHEN !EVAL(::beof())
MENUITEM "删除本行 Delete" ACTION EVAL(::bkeydown,VK_DELETE) WHEN !EVAL(::beof())
end

separator
MENUITEM "另存入Excel" ACTION ::SAVE()
MENUITEM "打印" ACTION ::REPORT(,.f.)
MENUITEM "打印预览" ACTION ::REPORT(,.t.)
separator
MENUITEM "表格设置:" ACTION tablesethelp(self)

MENUITEM "删除/隐藏/恢复栏位"
MENU
for nFor := 1 to nLen
oCol := ::aCols[ nFor ]
cPrompt := Trim( MemoLine( if(VALTYPE(oCol:cHeader)=="C",oCol:cHeader,EVAL(oCol:cHeader)), 250, 1 ) )
MenuAddItem( cPrompt, , !oCol:lHide, ( len(::aDisplay) != 1 .or. ocol:nPos != 1 ), GenMenuBlock( ::aCols, nFor ) )
next

ENDMENU
if ::bkeydown<>nil.and.::nMarqueeStyle==MARQSTYLE_HIGHLCELL
MENUITEM "更改字体颜色" ACTION (color1:=ChooseColor(),restorestate2(self,color1,color2))
MENUITEM "更改背景颜色" ACTION (color2:=ChooseColor(),restorestate2(self,color1,color2))
MENUITEM "恢复默认颜色" ACTION (restorestate2(self,CLR_BLACK,GetSysColor( 5 )))
end
if ::cid<>nil
MENUITEM "保存显示格式" ACTION savestate(self)
end
separator
MENUITEM "说明帮助" ACTION help(::ownd:ccaption)
ENDMENU

ACTIVATE POPUP oMenu2 AT nRow, nCol OF Self

6.Image
Image

Shuming Wang

Re: Xbrowse : Setup configuration file

PostPosted: Sun Apr 18, 2021 8:06 am
by Marc Venken
This will change the original Xbrowse code not? or do you subclass or how can we call it ?

I always want to keep the original from FW always.

Re: Xbrowse : Setup configuration file

PostPosted: Mon Apr 19, 2021 2:28 am
by ShumingWang
change the original Xbrowse code.

Shuming Wang