Page 1 of 2
Set Initial Focus Color
Posted: Mon Oct 26, 2020 3:47 pm
by Red2
I have what I trust is a very simple question about a Browse of a .DBF on a form.
I want the the Browse's very first (topmost) row to have and show focus. So, in the form's OnInit I issue the following:
Code: Select all
DBSelectArea( "MyItems" )
MyItems->( dbGoTop() )
// Then:
SetProperty( "DataBrowse", "BrowseItems", "Value", recno() )
// The top row now has focus.
Fine so far. However the selected (first) row's background color is an undesirable a
very light grey.
But now whenever the user selects a row then that row clearly shows its focus
by its
dark blue BACKGROUND color.
My Question:
I want that first row (with focus) to be initialized showing with the
dark blue background color.
What command(s) can I use to force this
dark blue background color?
Thank you for you kind assistance.
Red2
Re: Set Initial Focus Color
Posted: Mon Oct 26, 2020 5:43 pm
by SALINETAS24
Red2 wrote: ↑Mon Oct 26, 2020 3:47 pm
I have what I trust is a very simple question about a Browse of a .DBF on a form.
I want the the Browse's very first (topmost) row to have and show focus. So, in the form's OnInit I issue the following:
Code: Select all
DBSelectArea( "MyItems" )
MyItems->( dbGoTop() )
// Then:
SetProperty( "DataBrowse", "BrowseItems", "Value", recno() )
// The top row now has focus.
Fine so far. However the selected (first) row's background color is an undesirable a
very light grey.
But now whenever the user selects a row then that row clearly shows its focus
by its
dark blue BACKGROUND color.
My Question:
I want that first row (with focus) to be initialized showing with the
dark blue background color.
What command(s) can I use to force this
dark blue background color?
Thank you for you kind assistance.
Red2
Code: Select all
SetProperty( "DataBrowse", "BrowseItems", "Value", recno() )
DataBrowse.BrowseItems.setfocus
Saludos
Re: Set Initial Focus Color
Posted: Mon Oct 26, 2020 6:29 pm
by Red2
Hi SALINETAS24,
Gracias por su amable respuesta. Agregué la línea que sugirió como sugirió.
Desafortunadamente, el formulario no se compila. Crea:
C: \ HMG-Official \ DataBrowse_OnInit.PRG (69) Error E0030 Error de sintaxis "error de sintaxis en '.'"
Luego probé la siguiente sintaxis:
Code: Select all
SetProperty ("DataBrowse", "BrowseItems", "SetFocus")
Si bien se compilará, esto no ayuda con mi problema de fondo
azul oscuro.
Cualquier sugerencia adicional sería realmente apreciada.
English ==============================================
Thank your for your kind response. I added the line you suggested as you suggested.
Unfortunately the form does not compile. It creates:
C:\HMG-Official\DataBrowse_OnInit.PRG(69) Error E0030 Syntax error "syntax error at '.'"
I then tried the following syntax:
Code: Select all
SetProperty( "DataBrowse", "BrowseItems", "SetFocus" )
While it will compile this does
not to help with my
dark blue background problem.
Any further suggestions would really be appreciated.
Thanks again
Red2
Re: Set Initial Focus Color
Posted: Mon Oct 26, 2020 8:22 pm
by SALINETAS24
Hola Red, estaría bien que mandases algo más de código, por ver donde y como tienes defino del DATABROWSE.
A mi la instrucción que te pase me funciona correctamente, en un GRID eso si.
Un saludo.
Re: Set Initial Focus Color
Posted: Mon Oct 26, 2020 9:54 pm
by AUGE_OHR
hi Red,
SetFocus is NOT a Property, it is a Method
Code: Select all
Domethod( cForm, cGrid, "SetFocus" )
Re: Set Initial Focus Color
Posted: Mon Oct 26, 2020 10:13 pm
by Red2
Hi SALINETAS24,
Gracias (otra vez). Como mencioné, simplemente estoy examinando un .DBF en una TAB en un FORM.
Este formulario fue creado usando el IDE de HMG. No hay GRID aquí.
Claro que puede, aquí está el código de definición
BROWSE (no GRID).
Code: Select all
DEFINE BROWSE BrowseItems
ROW 52
COL 22
WIDTH 950
HEIGHT 388
VALUE 0
WIDTHS { 200, 150, 100, 160, 74, 67, 170 }
HEADERS {"Mfg. Name", "Type", "Size / Dim.", "Model", "Item Len.", "OAL", "Serial Number"}
WORKAREA My_Items
FIELDS {"My_Items->MFG_NAME", "My_Items->TYPE", "My_Items->SIZEDIM", "My_Items->MODEL", "My_Items->ITEM_LEN", "My_Items->OAL", "My_Items->SERIAL_NBR"}
FONTNAME "Arial"
FONTSIZE 9
TOOLTIP ""
ONCHANGE Nil
ONGOTFOCUS OnPageSelection( "My_Items" )
ONLOSTFOCUS Nil
FONTBOLD .F.
FONTITALIC .F.
FONTUNDERLINE .F.
FONTSTRIKEOUT .F.
ONDBLCLICK DataBrowse_BrowseItems_OnDblClick()
ALLOWEDIT .F.
ALLOWAPPEND .F.
ONHEADCLICK Nil
ALLOWDELETE .F.
HELPID Nil
VALID Nil
VALIDMESSAGES Nil
LOCK .F.
VSCROLLBAR .T.
DYNAMICBACKCOLOR { bkItems, bkItemType, bkItems, bkItems, bkItems, bkItems, bkItems }
DYNAMICFORECOLOR Nil
INPUTMASK Nil
FORMAT Nil
WHEN Nil
INPUTITEMS Nil
DISPLAYITEMS Nil
BACKCOLOR NIL
FONTCOLOR NIL
IMAGE Nil
JUSTIFY Nil
NOLINES .F.
READONLYFIELDS Nil
HEADERIMAGES Nil
END BROWSE
Cualquier ayuda es muy apreciada.
ENGLISH =================================
Thank you (once again). As I mentioned I am simply Browsing a .DBF in a TAB on a FORM.
This form was created using HMG's IDE. No GRID here.
Sure can, here is the
BROWSE (not GRID) definition code.
(SEE ABOVE)
Any help is greatly appreciated.
Red2
Re: Set Initial Focus Color
Posted: Mon Oct 26, 2020 10:28 pm
by Red2
Thank you Jimmy,
Of course you are correct, it is a Method.
I have tried putting
Code: Select all
DoMethod( "DataBrowse", "BrowseItems", "SetFocus" )
both
before and
after:
SetProperty( "DataBrowse", "BrowseItems", "Value", recno() )
In both cases my
BROWSE does
not initialize with the row in FOCUS having
dark blue BACKCOLOR.
It does not seem that this should be that hard in Harbour. Ideas anyone?
Again, thanks to all!
Red2
Re: Set Initial Focus Color
Posted: Mon Oct 26, 2020 10:41 pm
by AUGE_OHR
hi,
did you have
i do "setFocus" just before ACTIVATE
Re: Set Initial Focus Color
Posted: Mon Oct 26, 2020 11:21 pm
by Red2
Hi Jimmy,
Thank you very much.
Yes, in my Main.PRG (
SET BROWSESYNC ON) exists.
When:
Code: Select all
DoMethod( "DataBrowse", "BrowseItems", "SetFocus" )
// Comes immediately before
activate window DataBrowse
there is still no change to the BACKCOLOR of the row in focus in that BROWSE.
QUESTION: Is that what you were suggesting regarding
"just before ACTIVATE"?
I am grateful for your kind help. What am I missing here?
Kind regards,
Red2
Re: Set Initial Focus Color
Posted: Tue Oct 27, 2020 6:45 am
by AUGE_OHR
hi,
Browse have "Keyword"
so you can use Recno() at Create and must not use SetProperty()