Dear Rekan2,
Saya mendapatkan contoh script setting RowFocusIndicator.
Katakanlah datawindow telah di-set readonly='yes'
Bagaimana caranya agar supaya Column-aktif juga diberi highlight ?
Mohon pencerahannya
Regards
Steven
12 Types of RowFocusIndicator
This tip is a script used to create 12 types of RowFocusIndicators
including Color-Bands (White, Light-Yellow, ...) or Raised-Text-Band or
Standard PowerBuilder RowFocusIndicators. The function also creates,
destroys and changes them at run-time.
/*-----------------------------------------------
FUNCTION:
- boolean SetRfi(datawindow adw, int ai_rfi_cd)
PURPOSE/FUNCTIONALITY:
- Create ColorBand or RaisedTextBand to
serve as RowFocusIndicator for a Grid/Tabular
DataWindow.
- Switch Off/Destroy previously created
RowFocusIndicator
ARGUMENTS:
- adw : datawindow reference
- ai_rfi_cd : type of RowFocusIndicator to be set.
legal values: 0 to 12
0=Switch Off/Destroy
RETURNS:
- bool. True=Successful, False=Failed
HOW TO USE?
- Create this function as a window function or as a function
in a NVO with two arguments as under:
1. datawindow adw ... by value
2. integer ai_rfi_cd ... by value
and with boolean return
- If created as a function/event of datawindow, arument-1 (adw) is
not required. (Use "This" in lieu of "adw")
- Call it after dataobject is assigned to dataWindowControl.
- Function Call Example:
This.SetRfi(dw, 7)
- if created as a window function and called from the window,
assuming dataWindowControl is names as dw.
------------------------------------------------------------------------
------------------------------------------------------------------------
NO BAR ON USAGE
*/
string ls_h, ls_err, ls_msg, ls_mod, ls_obj
string ls_bg_colour //background color
long ll_width //width of band
ll_width = Long(adw.Object.DataWindow.HorizontalScrollMaximum)
//ai_rfi_cd = Integer Code for type of SetRowFocusIndicator
CHOOSE CASE ai_rfi_cd
CASE 0 //No RowFocusIndicator
adw.SetRowFocusIndicator(Off!)
//Destroy Previously created RowFocusIndicator Rectangle
//named "rf_rect"
ls_obj = adw.Object.DataWindow.Objects
if Pos(ls_obj, "rf_rect") > 0 then
ls_mod = "destroy rf_rect"
ls_err = adw.Modify(ls_mod)
if ls_err <> "" then
ls_err = "Modify Error:" + ls_err
PopulateError(-1, ls_err)
goto lbl_err
end if
end if
CASE 1
adw.SetRowFocusIndicator(Hand!)
CASE 2
adw.SetRowFocusIndicator(FocusRect!)
CASE 4 to 11
/*
CREATE COLORED BAND/RECTANGLE NAMED : rf_rect
It is preferable to define colors and other
constants in a global NVO. e.g.:
constant long LIGHT_YELLOW = RGB(255, 255, 200)
In case the NVO is named gc ("g" fot Global
and "c" fot constants). then one could
substitute below:
ls_bg_colour = string(RGB(255, 255, 200))
by
ls_bg_colour = string(gc.LIGHT_YELLOW)
*/
CHOOSE CASE ai_rfi_cd
CASE 4
ls_bg_colour = string(RGB(255, 255, 255)) //WHITE
CASE 5
ls_bg_colour = string(RGB(217, 217, 217)) //LIGHTER GRAY
CASE 6
ls_bg_colour = string(RGB(192, 192, 192)) //LIGHT GRAY
CASE 7
ls_bg_colour = string(RGB(255, 255, 200)) //LIGHT YELLOW
CASE 8
ls_bg_colour = string(RGB(255, 179, 217)) //LIGHT PINK
CASE 9
ls_bg_colour = string(RGB(140, 200, 200)) //LIGHT GREEN
CASE 10
ls_bg_colour = string(RGB(255, 211, 168)) //LIGHT ORANGE
CASE 11
ls_bg_colour = string(RGB(200, 255, 255)) //LIGHT BLUE
END CHOOSE
ll_width += adw.width
//Create Rectangle String
ls_mod = "Create Rectangle(band=detail" + &
" x='" + string(adw.X) + "'" +&
" y='0'" +&
" height='80~t if(1=1, RowHeight(), 80)'" +&
" width='" + string(ll_width) + "'" +&
" name=rf_rect " +&
" visible='1~t if(currentrow() = getrow(), 1, 0)'" +&
" brush.hatch='6'" + &
" brush.color='" + ls_bg_colour + "'" +&
" pen.style='0'" +&
" pen.width='5'" +&
" pen.color='" + string(gc.BLACK) + "'" +&
" background.mode='2'" +&
" background.color='0'" +&
")"
CASE 12
if adw.VscrollBar then
ll_width += adw.width - 130
else
ll_width += adw.width - 20
end if
//create string for raised text rectangle named : rf_rect
ls_mod = "create text(band=Detail" +&
" color='0'" +&
" border='6'" +&
" x='" + string(adw.X + 10) + "'" +&
" y='0'" +&
" height='80~t if(1=1, RowHeight() - 5, 80)'" +&
" width='" + string(ll_width) + "'" +&
" text=''" +&
" name=rf_rect" +&
" visible='1~t if(currentrow() = getrow(), 1, 0)'" +&
" background.mode='2'" +&
" background.color='12632256'" +&
" )"
CASE ELSE
ls_err = "Illegal Option: " + String(ai_rfi_cd) + " !"
PopulateError(-1, ls_err)
goto lbl_err
END CHOOSE
CHOOSE CASE ai_rfi_cd
CASE 4 to 12
ls_err = adw.Modify(ls_mod)
if ls_err <> "" then
ls_err = "Modify Error:" + ls_err
PopulateError(-1, ls_err)
goto lbl_err
end if
if adw.SetPosition("rf_rect", "detail", FALSE) <> 1 then
ls_err = "SetPosition Error."
PopulateError(-1, ls_err)
goto lbl_err
end if
END CHOOSE
return true
//-------------------------------------------------------------------
lbl_err:
ls_msg = error.Text + ". " +&
"Error/Msg No.=" + String(error.Number) + "; " +&
"Window/Menu=" + error.WindowMenu + "; " +&
"Object=" + error.Object + "; " +&
"ObjectEvent=" + error.Object + "; " +&
"Error Line No.=" + String(error.Line) + "."
MessageBox("Message/Error", ls_msg, Exclamation!)
return false
-----------------------------------------------
IndoPB - Indonesia PB User Group
An Indonesian PowerBuilder User Group's Event
2nd PowerBuilder Update
Rumah Sakit Jantung Harapan Kita
26/27 August 2006
To Register :
http://groups.yahoo.com/group/indopb/database?method=addRecord&tbl=4
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/indopb/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/indopb/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/