Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #3973 > unrolled thread
| Started by | Lu <lu2k@hotmail.com> |
|---|---|
| First post | 2012-08-21 07:53 -0700 |
| Last post | 2012-08-22 23:02 -0700 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
ContextMenuItem in bBrowser Lu <lu2k@hotmail.com> - 2012-08-21 07:53 -0700
Re: ContextMenuItem in bBrowser Mathias <mathias.hakansson@consultec.se> - 2012-08-21 22:34 -0700
Re: ContextMenuItem in bBrowser Lu <lu2k@hotmail.com> - 2012-08-22 05:27 -0700
Re: ContextMenuItem in bBrowser "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> - 2012-08-23 00:58 +1000
Re: ContextMenuItem in bBrowser Joachim Bieler <support@votools.com> - 2012-08-23 07:55 +0200
Re: ContextMenuItem in bBrowser Lu <lu2k@hotmail.com> - 2012-08-22 23:02 -0700
| From | Lu <lu2k@hotmail.com> |
|---|---|
| Date | 2012-08-21 07:53 -0700 |
| Subject | ContextMenuItem in bBrowser |
| Message-ID | <76b1a3d4-9052-4be3-8b80-a67badb24b96@googlegroups.com> |
Hi VO experts! How is it possible to check an item in a contextmenu in a bBrowser whether it is set disabled or not ? I tried some code like: self:odcbBrowser:ContextMenu:IsEnabled(IDM_mnu_ContextEdit_Context_New_ID) self:odcbBrowser:ContextMenu:IsEnabled(IDM_mnu_ContextEdit_Context_New_ID,#MenuItemID) but the method "IsEnabled" is not known. It appears an error code 13 "No exported Method" Have you any ideas to solve the problem! Thanks in advance for any hint. Lu
[toc] | [next] | [standalone]
| From | Mathias <mathias.hakansson@consultec.se> |
|---|---|
| Date | 2012-08-21 22:34 -0700 |
| Message-ID | <2c3ce167-b4be-4660-a45b-647b7473aa95@googlegroups.com> |
| In reply to | #3973 |
Hi Lu,
I do checks on context menus in bBrowser. I'm using av inherited browser class but I'll give you the key elements on how to do this.
The method GetColumnContextMenu in the bBrowser class is called the the browser needs to show a context menu. I provide my own method and generate my context menu there. I can detect which menu item the user selects by having my own MenuCommand method. There I can save a value to the field if I want to, but in this sample I just save a value (position number incrementer) to the registry.
class bMTRLBrowser inherit bBrowser
protect symMenuColumn as symbol
protect aCurrentmenu as array
method GetColumnContextMenu(symStyle as symbol,oColumn as object) as object pascal class bMTRLBrowser
local oPopup,oTop as PopupMenu
local a as array
local dwi,dwl as dword
local fPos as float
do case
case oColumn:Fieldsym == #POS
a := {{10. ,"+ 10,00"},;
{1. ,"+ 1,00"},;
{.1 ,"+ 0,10"},;
{.01 ,"+ 0,01"},;
{0. ,"+ 0,00"}}
oPopup := PopupMenu{}
oPopup:DeleteItem(IDM_POPUPMENU_PopUp_Meny_ID)
dwl := ALen(a)
for dwi := 1 upto dwl
oPopup:AppendItem(dwi,Hyperlabel{#DUMMY,a[dwi,2]})
next
s := MathiasQueryRTRegString("TenWin Kalkyl","Pos") // L
fPos := iif(Empty(s),1.0,Val(s))
do case
case fPos == 10. ;oPopup:CheckItem(1)
case fPos == 1. ;oPopup:CheckItem(2)
case fPos == .1 ;oPopup:CheckItem(3)
case fPos == .01 ;oPopup:CheckItem(4)
otherwise ;oPopup:CheckItem(5)
endcase
self:aCurrentmenu := a
if !Empty(a)
self:symMenuColumn := oColumn:Fieldsym
endif
oTop := PopupMenu{}
oTop:AppendItem(oPopup,"")
return oTop
method MenuCommand(oMenuCommandEvent) class bMTRLBrowser
local dwi,dwj as dword
local a as array
local lFound as logic
do case
case self:symMenuColumn == #POS
MathiasSetRTRegString("TenWin Kalkyl","Pos",Str(self:aCurrentmenu[oMenuCommandEvent:ItemID,1]))
endcase
self:aCurrentmenu := null_array
self:symMenuColumn := null_symbol
return nil
define IDM_POPUPMENU := "POPUPMENU"
define IDA_POPUPMENU := "POPUPMENU"
define IDM_POPUPMENU_PopUp_Meny_ID := 20196
resource IDM_POPUPMENU MENU
begin
MENUITEM "PopUp Meny", IDM_POPUPMENU_PopUp_Meny_ID
end
class POPUPMENU inherit Menu
method Init(oOwner) class POPUPMENU
super:Init(ResourceID{IDM_POPUPMENU, _GetInst( )})
self:RegisterItem(IDM_POPUPMENU_PopUp_Meny_ID, ;
HyperLabel{#_PopUp_Meny, ;
"PopUp Meny", ;
, ;
,})
return self
/Mathias
Den tisdagen den 21:e augusti 2012 kl. 16:53:32 UTC+2 skrev Lu:
> Hi VO experts!
>
>
>
> How is it possible to check an item in a contextmenu in a bBrowser whether it is set disabled or not ?
>
>
>
> I tried some code like:
>
>
>
> self:odcbBrowser:ContextMenu:IsEnabled(IDM_mnu_ContextEdit_Context_New_ID)
>
> self:odcbBrowser:ContextMenu:IsEnabled(IDM_mnu_ContextEdit_Context_New_ID,#MenuItemID)
>
>
>
> but the method "IsEnabled" is not known. It appears an error code 13 "No exported Method"
>
>
>
> Have you any ideas to solve the problem! Thanks in advance for any hint.
>
>
>
> Lu
[toc] | [prev] | [next] | [standalone]
| From | Lu <lu2k@hotmail.com> |
|---|---|
| Date | 2012-08-22 05:27 -0700 |
| Message-ID | <a0cd4f3d-974c-4559-a383-1db26f087a46@googlegroups.com> |
| In reply to | #3976 |
Thank you Mathias for your answer, but is there not an easier way to get the state of the contextmenu item??
[toc] | [prev] | [next] | [standalone]
| From | "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> |
|---|---|
| Date | 2012-08-23 00:58 +1000 |
| Message-ID | <is6Zr.773$tH2.96@viwinnwfe01.internal.bigpond.com> |
| In reply to | #3980 |
Lu
> Thank you Mathias for your answer, but is there not an easier way to get
> the state of the contextmenu item??
Easiest way is to start from a known state.
DisableAll() // items 1-5
EnableThose2UsedHere() // items 1, 3, 5
That way you know what's active and what's not active.
CYA
Steve
[toc] | [prev] | [next] | [standalone]
| From | Joachim Bieler <support@votools.com> |
|---|---|
| Date | 2012-08-23 07:55 +0200 |
| Message-ID | <a9lutfFa36U1@mid.individual.net> |
| In reply to | #3973 |
Hi Lu,
you can implement the method Menu:IsItemEnabled() with the code below:
method IsItemEnabled(iItemID) class Menu
local lEnabled as logic
local iState as dword
iState := GetMenuState(self:Handle(), iItemID, MF_BYCOMMAND)
if iState <> 0xffffffff .and. _And(iState, MFS_DISABLED) = 0
lEnabled := True
endif
return lEnabled
Regards,
Joachim Bieler
HTML clipboard
Am 21.08.2012 16:53, schrieb Lu:
> Hi VO experts!
>
> How is it possible to check an item in a contextmenu in a bBrowser whether it is set disabled or not ?
>
> I tried some code like:
>
> self:odcbBrowser:ContextMenu:IsEnabled(IDM_mnu_ContextEdit_Context_New_ID)
> self:odcbBrowser:ContextMenu:IsEnabled(IDM_mnu_ContextEdit_Context_New_ID,#MenuItemID)
>
> but the method "IsEnabled" is not known. It appears an error code 13 "No exported Method"
>
> Have you any ideas to solve the problem! Thanks in advance for any hint.
>
> Lu
[toc] | [prev] | [next] | [standalone]
| From | Lu <lu2k@hotmail.com> |
|---|---|
| Date | 2012-08-22 23:02 -0700 |
| Message-ID | <e9e8a437-ae2e-4df2-a823-dd957d511b9d@googlegroups.com> |
| In reply to | #3988 |
Thanks Joachim, such a method I have searched Lu
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web