• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] UI Problem

Status
Not open for further replies.
Level 20
Joined
Jul 12, 2010
Messages
1,717
Alright so after reading this tutorial from Tasyen and converting it to jass I'm having problems with creating an additional click-able glue button frame on top of it.
JASS:
    local framehandle click = BlzCreateFrameByType("GLUEBUTTON" , "ClickButton" , BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
But my problem is that the gluebutton is on top of the hover frame and prevents the tooltip from showing OR it's the other way around.

Code:
JASS:
function CreateItems takes nothing returns nothing
//------------Item 1-------------------
    local framehandle Item1 = BlzCreateFrameByType("BACKDROP", "Item1", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
    local framehandle Item1Hover = BlzCreateFrameByType("FRAME", "FaceFrame", Item1,"", 0)
    local framehandle Item1tooltip = BlzCreateFrame("BoxedText", Item1, 1, 1)
//------------Item 2-------------------
    local framehandle Item2 = BlzCreateFrameByType("BACKDROP", "Item2", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
    local framehandle Item2Hover = BlzCreateFrameByType("FRAME", "FaceFrame", Item2,"", 0)
    local framehandle Item2tooltip = BlzCreateFrame("BoxedText", Item2, 2, 2)
//------------Item 3-------------------
    local framehandle Item3 = BlzCreateFrameByType("BACKDROP", "Item3", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
    local framehandle Item3Hover = BlzCreateFrameByType("FRAME", "FaceFrame", Item3,"", 0)
    local framehandle Item3tooltip = BlzCreateFrame("BoxedText", Item3, 3, 3)
//------------End of Locals------------
//------------Item 1 Settings----------
    call BlzFrameSetAllPoints(Item1Hover, Item1)
    call BlzFrameSetTooltip(Item1Hover, Item1tooltip)
    call BlzFrameSetSize(Item1, 0.04, 0.04)
    call BlzFrameSetAbsPoint(Item1, FRAMEPOINT_CENTER, 0.5, 0.3)
//    call BlzFrameSetAbsPoint(Item1tooltip, FRAMEPOINT_CENTER, 0.2, 0.3)
    call BlzFrameSetPoint(Item1tooltip, FRAMEPOINT_BOTTOM, Item1, FRAMEPOINT_TOP, 0.0, 0.0)
    call BlzFrameSetSize(Item1tooltip, 0.15, 0.08)
    call BlzFrameSetText(BlzGetFrameByName("BoxedTextValue", 1), "This items gives good Attack Damage bonus.")
    call BlzFrameSetText(BlzGetFrameByName("BoxedTextTitle", 1), "Claws of Attack")
    call BlzFrameSetTexture(Item1, "ReplaceableTextures\\CommandButtons\\BTNClawsOfAttack",0, true)
//------------Item 2 Settings----------
    call BlzFrameSetAllPoints(Item2Hover, Item2)
    call BlzFrameSetTooltip(Item2Hover, Item2tooltip)
    call BlzFrameSetSize(Item2, 0.04, 0.04)
    call BlzFrameSetAbsPoint(Item2, FRAMEPOINT_CENTER, 0.1, 0.4)
//    call BlzFrameSetAbsPoint(Item2tooltip, FRAMEPOINT_CENTER, 0.2, 0.3)
    call BlzFrameSetPoint(Item2tooltip, FRAMEPOINT_LEFT, Item2, FRAMEPOINT_RIGHT, 0.0, 0.0)
    call BlzFrameSetSize(Item2tooltip, 0.15, 0.04)
    call BlzFrameSetText(BlzGetFrameByName("BoxedTextValue", 2), "This gem is shiny!")
    call BlzFrameSetText(BlzGetFrameByName("BoxedTextTitle", 2), "Green Gem")
    call BlzFrameSetTexture(Item2, "ReplaceableTextures\\CommandButtons\\BTNGem",0, true)
//------------Item 3 Settings----------
    call BlzFrameSetAllPoints(Item3Hover, Item3)
    call BlzFrameSetTooltip(Item3Hover, Item3tooltip)
    call BlzFrameSetSize(Item3, 0.04, 0.04)
    call BlzFrameSetAbsPoint(Item3, FRAMEPOINT_CENTER, 0.2, 0.3)
//    call BlzFrameSetAbsPoint(Item3tooltip, FRAMEPOINT_CENTER, 0.2, 0.3)
    call BlzFrameSetPoint(Item3tooltip, FRAMEPOINT_LEFT, Item3, FRAMEPOINT_RIGHT, 0.0, 0.0)
    call BlzFrameSetSize(Item3tooltip, 0.15, 0.08)
    call BlzFrameSetText(BlzGetFrameByName("BoxedTextValue", 3), "Makes you run faster.")
    call BlzFrameSetText(BlzGetFrameByName("BoxedTextTitle", 3), "Boots of Speed")
    call BlzFrameSetTexture(Item3, "ReplaceableTextures\\CommandButtons\\BTNBootsOfSpeed",0, true)
//-------------------------------------
endfunction
//===========================================================================
function InitTrig_Items takes nothing returns nothing
   set gg_trg_Items = CreateTrigger(  )
   call TriggerRegisterTimerEventSingle( gg_trg_Items, 0.50 )
   call TriggerAddAction( gg_trg_Items, function CreateItems)
   call BlzLoadTOCFile("war3mapimported\\BoxedText.toc")
endfunction
JASS:
function clicked takes nothing returns nothing
    call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 5.00, "Click." )
    call BlzFrameSetEnable(BlzGetTriggerFrame(), false) //disable the clicked button
    call BlzFrameSetEnable(BlzGetTriggerFrame(), true) //enable it again.
endfunction
function Trig_Melee_Initialization_Actions takes nothing returns nothing
    local trigger trig01 = CreateTrigger()
    local framehandle click = BlzCreateFrameByType("GLUEBUTTON" , "ClickButton" , BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
    call BlzFrameSetSize(click, 0.04, 0.04)
    call BlzFrameSetAbsPoint(click, FRAMEPOINT_CENTER, 0.5, 0.3)
    call BlzTriggerRegisterFrameEvent(trig01, click , FRAMEEVENT_CONTROL_CLICK)
    call TriggerAddAction(trig01, function clicked )
endfunction
//===========================================================================
function InitTrig_glue_button takes nothing returns nothing
    set gg_trg_glue_button = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_glue_button,0.60 )
    call TriggerAddAction( gg_trg_glue_button, function Trig_Melee_Initialization_Actions )
endfunction

Map Download: Here

Perhaps I'm using the wrong frame types?

+rep to anybody that can help, thanks!
 
I might not have said that in the Tooltip tutorial:
Frames beeing able to have a FRAMEEVENT_MOUSE_ENTER Event can also have have a Tooltip without any Frame that handles the hovering. In the tutorial the hoverframe is added cause a BACKDROP can not have that Event. But an GLUEBUTTON can, give the GLUEBUTTON the Tooltip and it should work.

Such a substitute FRAME is only needed when having only a BACKDROP or SIMPLEFRAMEs.
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
hmm it still doesn't work? I don't understand what I'm going wrong >_<
JASS:
function clicked takes nothing returns nothing
    call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 5.00, "Click." )
    call BlzFrameSetEnable(BlzGetTriggerFrame(), false) //disable the clicked button
    call BlzFrameSetEnable(BlzGetTriggerFrame(), true) //enable it again.
endfunction
//===========================================================================
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
//------------Item 1-------------------
    local trigger trig01 = CreateTrigger()
    local framehandle Item1 = BlzCreateFrameByType("BACKDROP", "Item1", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
    local framehandle Item1glue = BlzCreateFrameByType("GLUEBUTTON", "glue", Item1,"", 0)
    local framehandle Item1tooltip = BlzCreateFrame("BoxedText", Item1, 1, 1)
//------------Item 1 Settings----------
    call BlzFrameSetAllPoints(Item1glue, Item1)
    call BlzFrameSetTooltip(Item1glue, Item1tooltip)
    call BlzFrameSetSize(Item1, 0.04, 0.04)
    call BlzFrameSetAbsPoint(Item1, FRAMEPOINT_CENTER, 0.5, 0.3)
    call BlzFrameSetPoint(Item1tooltip, FRAMEPOINT_BOTTOM, Item1, FRAMEPOINT_TOP, 0.0, 0.0)
    call BlzFrameSetSize(Item1tooltip, 0.15, 0.08)
    call BlzFrameSetText(BlzGetFrameByName("BoxedTextValue", 1), "This items gives good Attack Damage bonus.")
    call BlzFrameSetText(BlzGetFrameByName("BoxedTextTitle", 1), "Claws of Attack")
    call BlzFrameSetTexture(Item1, "ReplaceableTextures\\CommandButtons\\BTNClawsOfAttack",0, true)
    call BlzTriggerRegisterFrameEvent(trig01, Item1glue , FRAMEEVENT_CONTROL_CLICK)
    call TriggerAddAction(trig01, function clicked )
endfunction
//===========================================================================
function InitTrig_glue_button takes nothing returns nothing
    set gg_trg_glue_button = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_glue_button, 0.50 )
    call TriggerAddAction( gg_trg_glue_button, function Trig_Untitled_Trigger_001_Actions )
endfunction
Only the click works.
 

Attachments

  • Item with Tooltip.w3x
    9 KB · Views: 45
Status
Not open for further replies.
Top