Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl - grid problem when i set focus
GridCtrl - grid problem when i set focus [message #56313] |
Fri, 19 February 2021 22:29  |
BetoValle
Messages: 204 Registered: September 2020 Location: Brasil Valinhos SP
|
Experienced Member |
|
|
Hi,
When i load GridCtrl the focus now show as espected
(at the beginning of the grid with blue highlighted line)
Why? (see *** )
#include <CtrlLib/CtrlLib.h>
#include <GridCtrl/GridCtrl.h>
using namespace Upp;
class PopUpWin : public GridCtrl
{
private:
bool poppedUp_;
bool Key ( dword key, int count )
{
if ( GetKeyDesc ( key ) == "Esc" )
{
fecha();
}
return false;
}
public:
PopUpWin() : poppedUp_ ( false ) { }
void SetPoppedUp ( bool yesNo )
{
poppedUp_ = yesNo;
}
bool IsPoppedUp() const
{
return poppedUp_;
}
void fecha()
{
Clear ( true );
Close();
poppedUp_ = false;
}
void gridProp(){
AddColumn ( "coluna1" );
AddColumn ( "coluna2" );
AddColumn ( "coluna3" );
Add ( "1", "1", "1" );
Add ( "2", "2", "2" );
Add ( "3", "3", "3" );
Add ( "4", "4", "4" );
MultiSorting ( true );
Searching();
find.NullText("busca");
SetToolBar ( BarCtrl::BAR_BOTTOM );
MultiSelect ( true );
Clipboard ( true );
ExtraPaste ( false );
FixedPaste ( false );
paste_allowed = false;
cut_allowed = false;
Indicator ( true );
Navigating ( true );
}
void Config ( Rect r, Ctrl* w, EditField* cpo )
{
LeftPos ( (fround ( r.right ) / 2 ) + 200, 300 ).TopPos ( fround ( r.bottom ) / 2 , 150 );
gridProp();
WhenLeftDouble = [=]
{
cpo->SetText( Get( GetCursor(),0).ToString() );
cpo->SetFocus();
fecha();
};
PopUp
(
w, // Ctrl* owner = NULL
true, // bool savebits = true
true, // bool activate = true
true, // bool dropshadow = false
false // bool topmost = false
);
}
};
class MainWin : public TopWindow
{
private:
//close grid
void LeftDown ( Point p, dword keyFlags )
{
if ( Single<PopUpWin>().IsPoppedUp() )
Single<PopUpWin>().fecha();
}
public:
typedef MainWin CLASSNAME;
Button button;
EditField fld;
void click()
{
if ( Single<PopUpWin>().IsPoppedUp() )
return;
Single<PopUpWin>().SetPoppedUp ( true );
Single<PopUpWin>().Config ( Size(800,600) , this,&fld);
// *** these 2 lines below don't work!
// *** should they work ?
Single<PopUpWin>().SetFocus();
Single<PopUpWin>().Begin();
}
MainWin()
{
button <<= THISBACK ( click );
button.SetLabel ( "show grid" );
Add ( fld.VCenterPos ( 23 ).HCenterPos ( 200 ) );
Add(button.LeftPosZ(304, 100).TopPosZ(304, 23));
}
};
GUI_APP_MAIN
{
SetLanguage ( "pt-br" );
MainWin mainWin;
mainWin.SetRect ( 0, 0, 800, 600 );
mainWin.Sizeable ( true );
mainWin.Run();
}
Thanks
|
|
|
Goto Forum:
Current Time: Sun May 11 07:52:20 CEST 2025
Total time taken to generate the page: 0.02971 seconds
|