1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] UI Problem

Discussion in 'Triggers & Scripts' started by xorkatoss, Aug 20, 2019.

  1. xorkatoss

    xorkatoss

    Joined:
    Jul 12, 2010
    Messages:
    1,515
    Resources:
    7
    Models:
    5
    Maps:
    1
    Spells:
    1
    Resources:
    7
    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.
    Code (vJASS):

        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:
    Code (vJASS):

    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
    Code (vJASS):

    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!
     
  2. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,304
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    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.
     
  3. xorkatoss

    xorkatoss

    Joined:
    Jul 12, 2010
    Messages:
    1,515
    Resources:
    7
    Models:
    5
    Maps:
    1
    Spells:
    1
    Resources:
    7
    hmm it still doesn't work? I don't understand what I'm going wrong >_<
    Code (vJASS):

    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.
     

    Attached Files:

  4. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,304
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    You didn't Load the TOC File. Hence the Tooltip-Frame can not be created/displayed.
     
  5. xorkatoss

    xorkatoss

    Joined:
    Jul 12, 2010
    Messages:
    1,515
    Resources:
    7
    Models:
    5
    Maps:
    1
    Spells:
    1
    Resources:
    7
    oh right forgot about that :eek:2...thanks!
     
  6. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,304
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    You could make your Button have a blue glowing effect when hovering or clicking it by inheriting an GLUEBUTTON having that behaviour. Inheriting is done by replacing the empty string "" after the parent with a name of a loaded frame for example "IconButtonTemplate".
     
  7. xorkatoss

    xorkatoss

    Joined:
    Jul 12, 2010
    Messages:
    1,515
    Resources:
    7
    Models:
    5
    Maps:
    1
    Spells:
    1
    Resources:
    7
    @Tasyen I think you should make a complete tutorial for GLUEBUTTON since it's so useful!

    I've been wondering why you didn't make that one yet. A lot of people can benefit from it :grin:
     
  8. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,304
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    Didn't wanted to write tutorials lately, also kinda thought the current ones would cover the Basics.