Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #8799 > unrolled thread

Deleting menuitem Separator

Started by"Jozo" <racunalo@os.t-com.hr>
First post2015-12-10 22:03 +0100
Last post2015-12-12 22:45 +0100
Articles 6 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Deleting menuitem Separator "Jozo" <racunalo@os.t-com.hr> - 2015-12-10 22:03 +0100
    Re: Deleting menuitem Separator "Jozo" <racunalo@os.t-com.hr> - 2015-12-10 23:28 +0100
      Re: Deleting menuitem Separator "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2015-12-11 21:44 +0100
        Re: Deleting menuitem Separator sherlocksoftware@gmail.com - 2015-12-11 14:05 -0800
        Re: Deleting menuitem Separator "Jozo" <racunalo@os.t-com.hr> - 2015-12-11 23:12 +0100
          Re: Deleting menuitem Separator "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2015-12-12 22:45 +0100

#8799 — Deleting menuitem Separator

From"Jozo" <racunalo@os.t-com.hr>
Date2015-12-10 22:03 +0100
SubjectDeleting menuitem Separator
Message-ID<n4cpa1$hgd$1@ls237.t-com.hr>
Hi all,

does anyone know how deleting specific SEPARATOR in Menu ?

Thanks for any help.


[toc] | [next] | [standalone]


#8800

From"Jozo" <racunalo@os.t-com.hr>
Date2015-12-10 23:28 +0100
Message-ID<n4cua5$jld$1@ls237.t-com.hr>
In reply to#8799
I found two solutions, Jean-Luc Stassen and Phil McGuinness.
Thank them



"Jozo" <racunalo@os.t-com.hr> wrote in message 
news:n4cpa1$hgd$1@ls237.t-com.hr...
> Hi all,
>
> does anyone know how deleting specific SEPARATOR in Menu ?
>
> Thanks for any help.
>
>
> 

[toc] | [prev] | [next] | [standalone]


#8801

From"Urs Eggmann" <Urs.Eggmann@shinternet.ch>
Date2015-12-11 21:44 +0100
Message-ID<dd0s0aFa241U1@mid.individual.net>
In reply to#8800
Hi Jozo,

By Google search I found a post from Roger Lawton (Sept 2005) with the 
method CleanMenu(PtrMenu) that calls a method CleanToolBar() .
That method I could not find.

What about sharing the complete solution with us ?

Thanks
Urs

"Jozo" <racunalo@os.t-com.hr> schrieb im Newsbeitrag
news:n4cua5$jld$1@ls237.t-com.hr...
>I found two solutions, Jean-Luc Stassen and Phil McGuinness.
> Thank them
>
>
>
> "Jozo" <racunalo@os.t-com.hr> wrote in message
> news:n4cpa1$hgd$1@ls237.t-com.hr...
>> Hi all,
>>
>> does anyone know how deleting specific SEPARATOR in Menu ?
>>
>> Thanks for any help.
>>
>>
>>
>
>

[toc] | [prev] | [next] | [standalone]


#8802

Fromsherlocksoftware@gmail.com
Date2015-12-11 14:05 -0800
Message-ID<4b93e20e-30a7-4638-9f64-9dc2f45efaf0@googlegroups.com>
In reply to#8801
METHOD DeleteSeparator(wItemId) AS VOID PASCAL CLASS SS_Menu

   LOCAL aItem := {} AS ARRAY
   //Purpose: Delete an item separator which occurs prior to a menu id
   aItem := SELF:GetItemInfo1(wItemId)
   // Delete the separator if the wItemId was found and the position prior to it is a separator
   IF ! (aItem == NULL_ARRAY) .AND. SELF:IsSeparator(aItem[2], aItem[3]-1)
      DeleteMenu(aItem[2], aItem[3]-1, MF_BYPOSITION )
   ENDIF
   //
   RETURN

METHOD GetItemInfo1(wItemID) AS ARRAY PASCAL CLASS SS_Menu

   LOCAL aRegItem := NULL_ARRAY AS ARRAY
   LOCAL wPos := 0      	AS DWORD //WORD
   //Purpose: Get the item info the brute force way
   wPos      := SELF:GetRegItemPos(wItemID)
   aRegItem  := SELF:GetItemInfo3(wItemId, wPos, SELF:handle())
   //
   RETURN aRegItem

METHOD GetRegItemPos(wItemId) AS DWORD PASCAL CLASS SS_Menu
   //Purpose: Return the position of the item in the array of menu items
   RETURN AScan(SELF:aRegItems, {|x| x[1] == wItemId })

METHOD GetitemInfo3( wItemId, wPos, wSubHandle ) AS ARRAY PASCAL CLASS SS_Menu

	LOCAL aRegItem 	 AS ARRAY
	LOCAL j, wSubItems AS WORD
	LOCAL sString 		 AS STRING
	LOCAL wID 				  AS WORD
	
	wSubItems := LoWord(GetMenuItemCount(wSubHandle))
	sString := NULL_STRING
	FOR j := 1 UPTO wSubItems
		IF wItemID == (wId := WORD(GetMenuItemID(wSubHandle, j-1)))
			aRegItem := { wItemID, wSubHandle, j-1, sString }
			EXIT
		ELSEIF wId == 65535        // Its a sub-menu
			sString := SELF:GetMenuString(wSubHandle, j-1)
			IF SELF:aRegItems[wPos,4] == sString
				aRegItem := { wItemID, wSubHandle, j-1, sString }
				EXIT
			ELSE
				IF ! ((aRegItem := SELF:GetItemInfo3(wItemId, wPos, GetSubMenu(wSubHandle, j - 1))) == NULL_ARRAY)
					EXIT
				ENDIF
			ENDIF
		ENDIF
	NEXT
      //
	RETURN aRegItem



_DLL FUNCTION DeleteMenu( hMenu AS PTR, uPosition AS DWORD, uFlags AS DWORD);
	AS LOGIC PASCAL:USER32.DeleteMenu

[toc] | [prev] | [next] | [standalone]


#8803

From"Jozo" <racunalo@os.t-com.hr>
Date2015-12-11 23:12 +0100
Message-ID<n4fho1$qkm$1@ls237.t-com.hr>
In reply to#8801
Hi Urs,

Here is method from Jean-Luc but I have excepted this piece of code because 
I don't need it.

METHOD CleanMenu( ptrMenu ) CLASS Izb
 LOCAL wCount  AS DWORD, nItemID  AS DWORD
 LOCAL ptrPopUp  AS PTR
 LOCAL lSeparator AS LOGIC
 LOCAL iIdx   AS INT, iCount  AS INT

 IF IsNil( ptrMenu )
     ptrMenu := SELF:Handle()
 ENDIF
 lSeparator := FALSE
 wCount  := ( GetMenuItemCount( ptrMenu ) - 1 )  // Zero Based
 iCount  := ( GetMenuItemCount( ptrMenu ) - 1 )  // Zero Based
 FOR iIdx := iCount DOWNTO 0
  nItemID := GetMenuItemID( ptrMenu, iIdx )
  DO CASE
   // a Sub-Menu
   CASE nItemID = 0xFFFFFFFF
    ptrPopUp := GetSubMenu( ptrMenu,  iIdx )
    IF GetMenuItemCount( ptrPopUp ) < 1
     DeleteMenu( ptrMenu, iIdx, MF_BYPOSITION )
    ELSE
     SELF:CleanMenu( ptrPopUp )
     IF GetMenuItemCount( ptrPopUp ) < 1
      DeleteMenu( ptrMenu, iIdx, MF_BYPOSITION )
     ENDIF
    ENDIF
    // a Separator
   CASE nItemID = 0
    IF lSeparator .or. ;
     ( iIdx = (GetMenuItemCount( ptrMenu ) - 1 ) ) .or. ; // separator at 
the END
     ( iIdx = 0 )           // separator at the beginning
     DeleteMenu( ptrMenu, iIdx, MF_BYPOSITION )
    ELSE
     lSeparator := TRUE
    ENDIF
   OTHERWISE
    lSeparator := FALSE
  ENDCASE
 NEXT
 IF ptrMenu == SELF:Handle()
//  SELF:CleanToolBar()
//  wCount := ( GetMenuItemCount( ptrMenu ) - 1 )  // Zero Based
//  SELF:SetAutoUpdate(wCount - 1)
 ENDIF
 RETURN NIL



"Urs Eggmann" <Urs.Eggmann@shinternet.ch> wrote in message 
news:dd0s0aFa241U1@mid.individual.net...
> Hi Jozo,
>
> By Google search I found a post from Roger Lawton (Sept 2005) with the 
> method CleanMenu(PtrMenu) that calls a method CleanToolBar() .
> That method I could not find.
>
> What about sharing the complete solution with us ?
>
> Thanks
> Urs
>
> "Jozo" <racunalo@os.t-com.hr> schrieb im Newsbeitrag
> news:n4cua5$jld$1@ls237.t-com.hr...
>>I found two solutions, Jean-Luc Stassen and Phil McGuinness.
>> Thank them
>>
>>
>>
>> "Jozo" <racunalo@os.t-com.hr> wrote in message
>> news:n4cpa1$hgd$1@ls237.t-com.hr...
>>> Hi all,
>>>
>>> does anyone know how deleting specific SEPARATOR in Menu ?
>>>
>>> Thanks for any help.
>>>
>>>
>>>
>>
>>
> 

[toc] | [prev] | [next] | [standalone]


#8804

From"Urs Eggmann" <Urs.Eggmann@shinternet.ch>
Date2015-12-12 22:45 +0100
Message-ID<dd3is8Fug6bU1@mid.individual.net>
In reply to#8803
Hi Jozo and Phil,

Thanks for completing the code.

Urs


"Jozo" <racunalo@os.t-com.hr> schrieb im Newsbeitrag 
news:n4fho1$qkm$1@ls237.t-com.hr...
> Hi Urs,
>
> Here is method from Jean-Luc but I have excepted this piece of code 
> because I don't need it.
>
> METHOD CleanMenu( ptrMenu ) CLASS Izb
> LOCAL wCount  AS DWORD, nItemID  AS DWORD
> LOCAL ptrPopUp  AS PTR
> LOCAL lSeparator AS LOGIC
> LOCAL iIdx   AS INT, iCount  AS INT
>
> IF IsNil( ptrMenu )
>     ptrMenu := SELF:Handle()
> ENDIF
> lSeparator := FALSE
> wCount  := ( GetMenuItemCount( ptrMenu ) - 1 )  // Zero Based
> iCount  := ( GetMenuItemCount( ptrMenu ) - 1 )  // Zero Based
> FOR iIdx := iCount DOWNTO 0
>  nItemID := GetMenuItemID( ptrMenu, iIdx )
>  DO CASE
>   // a Sub-Menu
>   CASE nItemID = 0xFFFFFFFF
>    ptrPopUp := GetSubMenu( ptrMenu,  iIdx )
>    IF GetMenuItemCount( ptrPopUp ) < 1
>     DeleteMenu( ptrMenu, iIdx, MF_BYPOSITION )
>    ELSE
>     SELF:CleanMenu( ptrPopUp )
>     IF GetMenuItemCount( ptrPopUp ) < 1
>      DeleteMenu( ptrMenu, iIdx, MF_BYPOSITION )
>     ENDIF
>    ENDIF
>    // a Separator
>   CASE nItemID = 0
>    IF lSeparator .or. ;
>     ( iIdx = (GetMenuItemCount( ptrMenu ) - 1 ) ) .or. ; // separator at 
> the END
>     ( iIdx = 0 )           // separator at the beginning
>     DeleteMenu( ptrMenu, iIdx, MF_BYPOSITION )
>    ELSE
>     lSeparator := TRUE
>    ENDIF
>   OTHERWISE
>    lSeparator := FALSE
>  ENDCASE
> NEXT
> IF ptrMenu == SELF:Handle()
> //  SELF:CleanToolBar()
> //  wCount := ( GetMenuItemCount( ptrMenu ) - 1 )  // Zero Based
> //  SELF:SetAutoUpdate(wCount - 1)
> ENDIF
> RETURN NIL
>
>
>
> "Urs Eggmann" <Urs.Eggmann@shinternet.ch> wrote in message 
> news:dd0s0aFa241U1@mid.individual.net...
>> Hi Jozo,
>>
>> By Google search I found a post from Roger Lawton (Sept 2005) with the 
>> method CleanMenu(PtrMenu) that calls a method CleanToolBar() .
>> That method I could not find.
>>
>> What about sharing the complete solution with us ?
>>
>> Thanks
>> Urs
>>
>> "Jozo" <racunalo@os.t-com.hr> schrieb im Newsbeitrag
>> news:n4cua5$jld$1@ls237.t-com.hr...
>>>I found two solutions, Jean-Luc Stassen and Phil McGuinness.
>>> Thank them
>>>
>>>
>>>
>>> "Jozo" <racunalo@os.t-com.hr> wrote in message
>>> news:n4cpa1$hgd$1@ls237.t-com.hr...
>>>> Hi all,
>>>>
>>>> does anyone know how deleting specific SEPARATOR in Menu ?
>>>>
>>>> Thanks for any help.
>>>>
>>>>
>>>>
>>>
>>>
>>
>
> 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web